@3dsource/metabox-front-api
    Preparing search index...

    Class GetScreenshot

    Represents a command to get a screenshot.

    To listen for changes after sending this command, listen to the 'screenshot' event before command is sent.

    Takes a screenshot on the server side (Unreal Engine) of the 3D scene. Returns high-quality image. Requires subscription to the screenshotReady event to receive the rendered image.

    Renders a high-res screenshot on the Unreal Engine server. Takes format ('image/png'|'image/jpeg'|'image/webp') and optional size ({x, y}). Returns base64 data via screenshotReady event. Use for thumbnails, social sharing, saving config snapshots, or attaching images to quotes.

    Subscribe to screenshotReady BEFORE sending GetScreenshot. Pattern: api.addEventListener('screenshotReady', (data) => { if(data) saveImage(data, 'name.png'); }). Specify size for consistent outputs: new GetScreenshot('image/png', {x:2048, y:2048}). Use saveImage() helper to convert base64 to downloadable file.

    import { Communicator,saveImage,GetScreenshot } from '@3dsource/metabox-front-api';
    window.env3DSource.apiReady = (api: Communicator) => {

    //Subscribe to the event before sending the command to ensure you capture the response
    api.addEventListener('screenshot', (data:string) => {
    // The data is a base64 string of the image. You can use it to display the image or save it as a file.
    console.log('Get screenshot here:', data);
    saveImage(data, 'Render.png');
    });

    api.sendCommandToMetabox(new GetScreenshot('image/png', { x: 1024, y: 1024 }));
    };

    The output format.

    Optional size in pixels.

    Index

    Constructors

    Properties

    Constructors

    • Parameters

      • mimeType: MimeType
      • Optionalsize: { x: number; y: number }

      Returns GetScreenshot

    Properties

    data: ToMetaBoxMessageEnvelope

    The message envelope populated by subclass constructors and sent via Communicator.sendCommandToMetabox.