Niagara emitter 继承 Parent emitter module 功能在特定操作下会失效

我们遇到了与另一个提问相同的问题,并有了明确的复现方法:

[Content removed]

1.新建一个 niagara emitter 作为测试的 parent emitter,其默认的 Emitter Properties - Interpolated Spawn Mode 参数应该是 Interpolation

2.新建一个 niagara system,创建一个继承自测试 parent emitter 的 子emitter,其 Particle Spawn - Initialize Particle 模块此时是锁定状态

3.修改 子emitter 的 Emitter Properties - Interpolated Spawn Mode 为 No Interpolation

4.修改 子emitter 的 Particle Spawn - Initialize Particle 模块的任意参数使其与 parent emitter 不同,如修改 LifeTime

5.编译,保存

6.点击刚才修改的 Initialize Particle 参数后的绿色箭头

7. Initialize Particle 已经解锁

我们定位到产生此问题的直接原因如另一个提问所述,

UNiagaraStackModuleItem::CanMoveAndDelete

bool bIsMergeable = MergeManager->IsMergeableScriptUsage(OutputNode->GetUsage());

OutputNode的Usage被修改成了ParticleSpawnScriptInterpolated,不在IsMergeableScriptUsage所定义的几种枚举中

而OutputNode的Usage是在点击绿色箭头时被修改的:

if (DiffResults.ChangedOtherUsage.IsSet())

{

BaseScriptStackAdapter->GetScript()->SetUsage(DiffResults.ChangedOtherUsage.GetValue());

BaseScriptStackAdapter->GetOutputNode()->SetUsage(DiffResults.ChangedOtherUsage.GetValue());

}

看起来此处修改OutputNode的Usage是一个bug,但我们不确定注释掉这行是否会产生其他影响

Script的Usage和对应的OutputNode的Usage是否应该永远保持一致?

如果永远保持一致此处就是正确的,应该修改IsMergeableScriptUsage函数?还是bug在别处?

如果可能不一致,什么情况会导致两个Usage不一致?这样设计的目的是什么?

重现步骤
我们遇到了与另一个提问相同的问题,并有了明确的复现方法:​

[Content removed]

1.新建一个 niagara emitter 作为测试的 parent emitter,其默认的 Emitter Properties - Interpolated Spawn Mode 参数应该是 Interpolation

2.新建一个 niagara system,创建一个继承自测试 parent emitter 的 子emitter,其 Particle Spawn - Initialize Particle 模块此时是锁定状态

3.修改 子emitter 的 Emitter Properties - Interpolated Spawn Mode 为 No Interpolation

4.修改 子emitter 的 Particle Spawn - Initialize Particle 模块的任意参数使其与 parent emitter 不同,如修改 LifeTime

5.编译,保存

6.点击刚才修改的 Initialize Particle 参数后绿色箭头

7. Initialize Particle 已经解锁

您好,

我可以复现问题, 和开发同事沟通中. 有反馈立即回复你, 感谢!

您好,

抱歉回复迟了, 开发同事刚刚修了这个问题, 可以合一下: perforce 主分支 ​48994950

Diff script的时候需要忽略Interpolation的改动, Niagara目前不会合并emitter property. 所以修复是将FNiagaraScriptMergeManager::DiffScriptStacks的最后的判断改为:

// We need to ignore the interpolation setting when checking script usage as the emitter is the controller for this 
//and we don't merge the emitter properties right now
auto GetUsageIgnoreInterpolation = 
       [](ENiagaraScriptUsage InUsage) -> ENiagaraScriptUsage
       {
	       return InUsage == ENiagaraScriptUsage::ParticleSpawnScriptInterpolated ? ENiagaraScriptUsage::ParticleSpawnScript : InUsage;
       };
if (GetUsageIgnoreInterpolation(BaseScriptStackAdapter->GetScript()->GetUsage()) != GetUsageIgnoreInterpolation(OtherScriptStackAdapter->GetScript()->GetUsage()))
{
	DiffResults.ChangedBaseUsage = BaseScriptStackAdapter->GetScript()->GetUsage();
	DiffResults.ChangedOtherUsage = OtherScriptStackAdapter->GetScript()->GetUsage();
}

好的,谢谢