Class PreviewSectionGui
Shared IMGUI shape for the Animation Hub's rendered preview sections: the "Preview" foldout (collapsed by default, drawing nothing while collapsed) and the viewport rect that renders its texture only on UnityEngine.EventType.Repaint and only once a preview instance exists, then blits the result through Serenity.Global.Infrastructure.Editor.Preview.ModelPreviewViewportBlit. AnimationClipPreviewScrubber and ProceduralAnimatorSimulatorGui both drive a Serenity.Global.Infrastructure.Editor.Preview.SerenityModelPreviewSession this same way; this is the one place that shape is spelled out.
Inherited Members
Namespace: Serenity.Editor.AnimationHub.Gui
Assembly: Serenity.AnimationHub.Editor.dll
Syntax
public static class PreviewSectionGui
Methods
DrawFoldout(ref bool, Action)
Draws the "Preview" foldout label; while expanded, runs drawExpandedContent
inside a helpBox vertical scope. expanded is a ref so each caller keeps its own
persisted expansion state (an instance field for a per-panel scrubber, a static field for a
single-shared simulator section).
Declaration
public static void DrawFoldout(ref bool expanded, Action drawExpandedContent)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | expanded | |
| Action | drawExpandedContent |
DrawSessionViewport(float, bool, Func<Rect, Texture>, string, SerenityModelPreviewSession, Action)
Draws a height-tall viewport rect: renderTexture runs
only during UnityEngine.EventType.Repaint and only when hasInstance — a
Layout-pass call must never render a throwaway frame, and there is nothing to render before a preview
instance exists — then the result (or a null texture, when there is nothing to show) is blitted
through Serenity.Global.Infrastructure.Editor.Preview.ModelPreviewViewportBlit along with statusText. When
session supports it (see Serenity.Global.Infrastructure.Editor.Preview.SerenityModelPreviewSession.SupportsOrbit),
a left-button drag inside the rect orbits the camera, the scroll wheel zooms it, and a double-click
resets both — each consuming its UnityEngine.Event and firing requestRepaint so
the interaction tracks the mouse smoothly.
Declaration
public static void DrawSessionViewport(float height, bool hasInstance, Func<Rect, Texture> renderTexture, string statusText, SerenityModelPreviewSession session, Action requestRepaint)
Parameters
| Type | Name | Description |
|---|---|---|
| float | height | |
| bool | hasInstance | |
| Func<Rect, Texture> | renderTexture | |
| string | statusText | |
| SerenityModelPreviewSession | session | |
| Action | requestRepaint |