不好意思我可能没描述好我的问题,我再补充一点包括我自己对这个问题的看法。
首先我提出的问题是,当用户在Sequencer中添加一条PostProcessVolume的轨道K帧时K的bool类型字段无效,如下图所示准备K两个属性。
[Image Removed]
第一个是bool类型的属性
/** Enables ray tracing ambient occlusion. */ UPROPERTY(interp, EditAnywhere, BlueprintReadWrite, Category = "Rendering Features|Ray Tracing Ambient Occlusion", meta = (editcondition = "bOverride_RayTracingAO", DisplayName = "Enabled")) uint32 RayTracingAO : 1;
第二个是float类型的字段。
/** Defines the world-space search radius for occlusion rays. */ UPROPERTY(interp, EditAnywhere, BlueprintReadWrite, Category = "Rendering Features|Ray Tracing Ambient Occlusion", meta = (ClampMin = "0.0", ClampMax = "10000.0", editcondition = "bOverride_RayTracingAORadius", DisplayName = "Radius")) float RayTracingAORadius;
因为PostProcessVolume中的字段比较特殊,每个字段都会有一个对应的 “bOverride_XXX” 字段去表示这个属性是否会被重载(详见 Scene.h),也就是下图中前面那个checkbox的意义。
[Image Removed]
除了 UMovieSceneBoolSection 之外其他的值类型 Section 统一都在 MovieSceneTracks 这个模块里,比如 UMovieSceneFloatSection 他们都会继承 IMovieSceneEntityProvider 接口,并在UMovieSceneFloatSection::PopulateEvaluationFieldImpl 中调用 FMovieScenePropertyTrackEntityImportHelper::PopulateEvaluationField
截取一段 FMovieScenePropertyTrackEntityImportHelper::PopulateEvaluationField 中的代码注释
// Check if this section is animating a property with an edit-condition. If so, we need to also animate a boolean toggle // that will be set to true while the main property is animated. UMovieScenePropertyTrack* PropertyTrack = Section.GetTypedOuter<UMovieScenePropertyTrack>(); UMovieScene* MovieScene = Section.GetTypedOuter<UMovieScene>(); if (PropertyTrack && MovieScene) { ... }
这里会自动将 bOverride_XXX 设置成 true,也就是在Sequencer中K帧时可以看到 PostProcessVolume 中对应属性前面的CheckBox自动打钩了。
但是 UMovieSceneBoolSection 比较特殊,它写在了 MovieScene 这个Module里,所以没有调用 FMovieScenePropertyTrackEntityImportHelper::PopulateEvaluationField,缺少了这部分对 EditCondition 和 bOverride_XXX 的处理逻辑,在Sequencer中K帧时会发现 PostProcessVolume 中的 Override Checkbox 不会自动打钩,用户K的bool字段实际不会生效。
我在附件工程里已经准备好了 LevelSequence 和 PostProcessVolume Actor,可以直接看。