| 403 | } |
| 404 | |
| 405 | SceneRenderTask* ParticleEffect::GetRenderTask() const |
| 406 | { |
| 407 | const uint64 minFrame = Engine::FrameCount - 2; |
| 408 | |
| 409 | // Custom task |
| 410 | const auto customViewRenderTask = CustomViewRenderTask.Get(); |
| 411 | if (customViewRenderTask && customViewRenderTask->Enabled && customViewRenderTask->LastUsedFrame >= minFrame) |
| 412 | return customViewRenderTask; |
| 413 | |
| 414 | // Main task |
| 415 | const auto mainRenderTask = MainRenderTask::Instance; |
| 416 | if (mainRenderTask && mainRenderTask->Enabled && mainRenderTask->LastUsedFrame >= minFrame) |
| 417 | return mainRenderTask; |
| 418 | |
| 419 | // Editor viewport |
| 420 | #if USE_EDITOR |
| 421 | for (auto task : RenderTask::Tasks) |
| 422 | { |
| 423 | if (task->LastUsedFrame >= minFrame && task->Enabled) |
| 424 | { |
| 425 | if (const auto sceneRenderTask = Cast<SceneRenderTask>(task)) |
| 426 | { |
| 427 | if (sceneRenderTask->ActorsSource == ActorsSources::Scenes) |
| 428 | { |
| 429 | return sceneRenderTask; |
| 430 | } |
| 431 | } |
| 432 | } |
| 433 | } |
| 434 | #endif |
| 435 | return nullptr; |
| 436 | } |
| 437 | |
| 438 | #if USE_EDITOR |
| 439 | |