Texturge 模块详解
Texturge 插件包含两个模块:Texturge(Runtime)与 TexturgeEditor(Editor)。不存在独立的 Baker、Renderer 或 GPU 管线模块。
Texturge 模块(Runtime)
模块概述
- Module Class:
FTexturgeModule,实现 IModuleInterface
- 加载阶段:
Default(游戏启动时加载)
- 日志类别:
LogTexturge
动画蓝图系统
| 类 | 说明 |
|---|
UTextAnimationBlueprint | UBlueprint 子类。属性:GlyphAnimations(TArray<UGlyphAnimation*>)、Tracks(@deprecated 兼容)、StageTransitionConfig、VariableNameToGuidMap、CompileCount。方法:CreateAnimInstance()、GetTotalDuration()、GetTrackById() |
UTextAnimInstance | 编译后蓝图 CDO + 烘焙缓存持有者。BlueprintNativeEvent:BuildDefaultAnimation(int32 GlyphCount, const FString& Text)。蓝图变量设置 4 重载(float / FVector / FLinearColor / FVector2D)、静态 BuildScheduleInfos()、GetAnimationByName()、GetCharacterCount()、EvaluateBaked(float) |
UTextAnimationBlueprintGeneratedClass | UBlueprintGeneratedClass 子类,持有编译输出(CompiledTracks / CompiledFrameRate / CompiledTotalDuration / CompiledCharacterInterval) |
烘焙数据层
| 类 | 说明 |
|---|
FAnimationCompiler | 纯函数编译器(静态方法)。入口:BakeAllStages(UTextAnimationBlueprint*, const FString&, const FAnimInstanceCustomizer& = nullptr) → FBakedAnimation。其他:BuildScheduleInfos()、ExtractCurves() / ExtractCurvesRef()(零拷贝)、ConvertFloatChannelToRichCurve()、BakeStage()、BakeStageWithCurves()、ComputeTextFingerprint()、ComputeBlueprintFingerprint()、MinFramesBetweenRebakes = 3 |
FBakedAnimation | 非 USTRUCT。TUniquePtr<FBakedStage> Intro/Default/Outro 三阶段 + 双指纹。方法:GetStage() / HasStage() / GetFirstValidStage() / GetNextStageAfter() / GetTotalDuration() |
FBakedStage | USTRUCT。StageType / GlyphCount / TotalDuration / Glyphs。方法:IsValid() / GetStartedGlyphCount() |
FBakedGlyph | USTRUCT。OriginalIndex / StartTime / Duration / bIsStatic / DefaultState / bHideFirstFrame / LayerCurves / FactoryOverride。核心方法:Evaluate(StageTime, OutState) |
FPerLayerCurves | USTRUCT。21 个 TArray<FRichCurveKey> + BlendMode + PlayDirection + NumberOfLoops + PlaySpeedMultiplier + LayerDuration。方法:Evaluate() / IsEmpty() / GetEffectiveDuration() |
FGlyphCurveSet | 非 USTRUCT(21 条 FRichCurve),仅 C++ 内部临时计算用 |
FGlyphCurveOverride | USTRUCT。10 个属性的有序微调步骤(FGlyphFloatOverrideStep / FGlyphVec2OverrideStep / FGlyphColorOverrideStep) |
FGlyphScheduleBuilder | 纯静态调度工具(AddPerGlyphDelay / SkipWhitespace / SetDelayAt / SkipAt) |
图层与工厂
| 类 | 说明 |
|---|
UGlyphAnimationLayer | 图层包装(73 个蓝图函数):曲线深拷贝副本 + 调度 + 字形微调 + 动画剪切。链式 API 返回自身 |
UGlyphAnimationFactory | 多图层合并烘焙器(69 个蓝图函数):层管理 + 全局调度 + 微调 + Bake() 三步管线 |
UGlyphAnimation | UMovieSceneSequence 子类。GetDuration() / GetTrackTypes() / HasTrackType() |
运行时控制器
| 类 | 说明 |
|---|
UTextAnimationStageController | 阶段播放引擎。播放控制:Play() / Pause() / Resume() / Stop() / RevealAll() / SetPlayDirection() / SetLoop() / TickAnimation() / EvaluateAllGlyphs()。查询:IsPlaying() / IsComplete() / GetCurrentStage() / GetStageTime() / GetRevealedGlyphCount() / GetTotalGlyphCount()。注入:Initialize() / PublishBakedAnimation()。委托:OnGlyphRevealed / OnStageChanged / OnAnimationComplete |
UTextAnimator | 富文本打字机引擎(全部为普通 C++ 方法,零蓝图函数)。SetPlainText() / SetRichText() / SetAnimationData() / SetAnimationBlueprint() / SetPlaybackMode() / SetCPS() / SetPlayMode() / SetPlaySpeedMultiplier() / SetSequentialPlayback() / SetMaxLoopCount() / StartAnimating() / TickAnimation() / Pause() / Resume() / Stop() / SkipToEnd() / GetCurrentFrameDataArray() 等 |
UMG 控件
| 类 | 说明 |
|---|
UAnimatedTextBlock | UTextBlock 子类。12 个蓝图函数(播放控制 6 + 蓝图变量 6)+ 2 个蓝图委托。属性:TextAnimationBlueprint / ParameterOverrides / bAutoPlay / bLoopPlayback |
UAnimatedRichTextBlock | URichTextBlock 子类。播放控制 6 个蓝图函数 + 2 个蓝图委托。属性:AnimationData / bAutoPlay / bLoopPlayback / bSequentialPlayback |
UEventSoundComponent | UActorComponent 子类。字符音效映射 + 标点延迟 + 动画器绑定 |
富文本系统
| 类 | 说明 |
|---|
UTextAnimationDataAsset | UDataAsset。Entries(TArray<FAnimationEntry>) |
FAnimationEntry | USTRUCT。TagName(FName)+ Type(TObjectPtr<UTextAnimationBlueprint>)+ 6 组覆盖 Map + bHideFirstFrame |
FTagParser | 解析器。Parse(const FString&, FString& OutPlainText) → TSharedPtr<FTagNode> |
FRenderTreeBuilder | 构建器。Build(ParseRoot, PlainText, DataAsset) → FRenderNode、SerializeToDisplayText()、SerializeSubstring() |
FRichTextMarshaller | 私有 Marshaller,富文本逐字形渲染(UE5.8 起每行独立 ModelString,行终止符前缀计算) |
本地化与 Unicode
| 类 | 说明 |
|---|
ULocalizationSubsystem | UGameInstanceSubsystem。SetLanguage()(触发 OnLanguageChanged 广播)、静态 RelocateAnchors()(精确匹配 + LCS 近似 + 置信度去重,MaxTextLength = 10000) |
FSemanticAnchor | USTRUCT。AnchorId / ContextualSnippet / SourceOffset |
FCharBreakIterator | IBreakIterator 实现,预计算断点数组(CJK / Surrogate Pair / Emoji 簇安全) |
Texturge::Unicode | 命名空间工具:IsCJK() / IsCJKPunctuation() / IsHiragana() / IsKatakana() / IsHangulSyllables() / 代理对合成 |
Texturge::GlyphRender | 命名空间工具:ApplyTint()(PBM 物理颜料混色)、SRGBToLinearChannel() / LinearToSRGBChannel()、BuildGlyphTransform()、IsSdfFont() 等 |
设置
| 类 | 说明 |
|---|
UTexturgeSettings | UDeveloperSettings,分类 "Plugins/Texturge",当前无配置项,仅 Get() 静态访问 |
Build.cs 依赖
// PublicDependencyModuleNames
"Core", "CoreUObject", "Engine",
"Slate", "SlateCore", "UMG",
"MovieScene", "MovieSceneTracks",
"DeveloperSettings"
TexturgeEditor 模块(Editor)
模块概述
- Module Class:
FTexturgeEditorModule,实现 IModuleInterface
- 加载阶段:
Default(仅编辑器环境加载)
- 职责: 注册 Sequencer 轨道编辑器、细节面板(Details)定制、编辑器命令(
FTexturgeEditorCommands)
- 日志类别:
LogTexturgeEditor
蓝图编辑器
| 类 | 说明 |
|---|
FTextAnimationBlueprintEditor | FBlueprintEditor 子类。Designer / Graph 双模式 + 7 标签页。方法:InitTextAnimationEditor() / Compile() / GetSequencer() / ChangeViewedAnimation() / SetActivePreviewSource() / GetPreviewSourceMediator() / GetPreviewSceneConfig() / AddTrack() / RemoveTrack() 等 |
FTextAnimBPDesignerMode / FTextAnimBPGraphMode | FBlueprintEditorApplicationMode 子类,注册标签页工厂 |
FTextAnimationBlueprintCompilerContext | FKismetCompilerContext 子类(Private/Compiler)。ValidateTrackData() / FixupVariableGUIDs() / CopyAssetDataToClass() |
UTextAnimationBlueprintFactory | UFactory,内容浏览器创建资产 |
UAssetDefinition_TextAnimationBlueprint | 资产定义(显示名 / 颜色 / 分类 / 打开行为) |
设计视口与预览
| 类 | 说明 |
|---|
STextAnimationDesignerView | 主设计视口(STextAnimationDesignSurface + FGCObject + IUMGDesigner)。SetPreviewFrameDataOverride() / 预览尺寸 / 字体度量 |
FPreviewSourceMediator | 预览源仲裁(None / StagePreview / GlyphAnimation)。RequestSource() / RegisterObserver() / TickPreview() / InvalidateBakeCache() / SetActiveOverrides()(4 组) |
FTexturgePreviewBakeCache | 预览烘焙缓存(双键:TextFingerprint + BlueprintFingerprint) |
UTexturgePreviewSceneConfig | 预览场景配置(27 个字段,持久化 EditorPerProjectUserSettings) |
STextAnimationPreviewWidget / STextAnimationPreviewList / STextAnimationList / STextAnimationGraphPreview | 预览与列表 Slate 控件(Private/Designer) |
Sequencer 集成
| 类 | 说明 |
|---|
UMovieSceneGlyphAnimationTrack | Sequencer 主轨道(UMovieSceneNameableTrack,多行支持) |
UMovieSceneGlyphAnimationSection | 子轨道区段(FTextAnimationSubTrackData) |
FGlyphAnimationTrackEditor | Sequencer 轨道编辑器 UI(FMovieSceneTrackEditor 子类,Private/TrackEditors),由 FTexturgeEditorModule 注册 |
细节面板定制
| 类 | 说明 |
|---|
FAnimatedTextBlockDetails | UAnimatedTextBlock 详情(IDetailCustomization,参数行 + Reset) |
FTextAnimationInstanceDetails | UTextAnimInstance 详情(IDetailCustomization,仅分类排序) |
FAnimationEntryDetails | FAnimationEntry 详情(IPropertyTypeCustomization) |
UTextAnimationTrackProxy | 轨道属性编辑代理 |
AnimParamTraitsHelpers.h | AnimParamNeedsReset / AnimParamReset / AnimParamSync 模板 |
Build.cs 依赖
// PublicDependencyModuleNames
"Texturge",
"Slate", "SlateCore",
"UMGEditor",
"KismetCompiler",
"Sequencer", "SequencerCore",
"BlueprintGraph",
"PropertyEditor"
images/module-dependencies.png — 模块依赖关系图:TexturgeEditor(左侧)依赖 Texturge 运行时模块(右侧),两者底部标注各模块依赖的引擎模块(Slate/UMG/MovieScene/KismetCompiler/Sequencer 等),Editor 依赖标记为编辑器专属 — Module dependency diagram: TexturgeEditor (left) depends on Texturge runtime module (right), engine module dependencies (Slate/UMG/MovieScene/KismetCompiler/Sequencer etc.) listed at the bottom of each, editor dependencies marked editor-only