How do I tell which viewport is being rendered?

I’ve got a plugin that uses FSceneViewExtensionBase to add a custom render pass. One thing I need is the viewport size, however, I’ve noticed the custom pass gets called for what I assume to be content browser thumbnails as I get a viewport size of 256x256 when the content browser gets opened.

How can I tell if it’s the thumbnails or whatever that isn’t the main game viewport, is being rendered?

For functions like PreRenderViewFamily_RenderThread you have an FSceneViewFamily reference that has a bThumbnailRendering variable but it seems to return false no matter what.

I only want the main viewport, nothing else. Anyone have any ideas? It doesn’t need to be from the game thread or render thread specifically as using the current viewport size is a manual operation.

Also, this isn’t much of an issue for a packaged game, but it makes working with it in the editor a pain. And I’m using 5.2, 5.3 & 5.4 for this.

Ok found a solution, it doesn’t directly answer my initial question but it gives me the result I need.

So you have a reference to a FSceneViewFamily object, in this object is a FSceneInterface pointer variable called Scene which contains a pointer to the world.
Now the world has a type which I can just do a check to see if it’s not an editor preview world.

InViewFamily.Scene->GetWorld()->WorldType != EWorldType::EditorPreview

I do also make sure that it’s not thumbnail rendering or that the view does actually have a state.

    // Inside my FSceneViewExtensionBase subclass
  	virtual void SetupView(FSceneViewFamily& InViewFamily, FSceneView& InView) override
  	{
  		bIsNormalRendering = !InViewFamily.bThumbnailRendering
  		&& InView.State != nullptr
#if WITH_EDITOR
  		&& InViewFamily.Scene->GetWorld()->WorldType != EWorldType::EditorPreview
#endif
  		;
  	};

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.