Lens Scripting API

    Class ImagePickerTextureProvider

    Controls an image picker texture and UI. Can be accessed through Texture.control on an Image Picker texture. For more information, see the Image Picker Texture guide.

    // @input Asset.Texture imagePickerTexture

    // Show the image picker UI
    script.imagePickerTexture.control.showImagePicker();

    // Set a callback for when the user picks a different image from the image picker
    script.imagePickerTexture.control.setImageChangedCallback(function(){
    print("image picker image changed");
    });

    Hierarchy (View Summary, Expand)

    Index

    Constructors

    Properties

    autoShowImagePicker: boolean

    If enabled, the image picker UI will be shown automatically when the Lens starts.

    autoShowMediaPicker: boolean

    If set to true, MediaPickerTextureProvider will request media picker UI automatically during loading.

    cropFace: boolean

    If set to true, MediaPickerTextureProvider will provide a proper texture transform for image with face(s), that will "zoom" UVs to the first found face on the image.

    faceImageControl: FaceTextureProvider

    Returns underlying TextureProvider for the last selected media file. If the last media file was not image with at least one face, null is returned.

    faceRect: vec4
    imageControl: TextureProvider

    Returns underlying TextureProvider for the last selected media file. If the last media file was not image, null is returned.

    isContentReady: boolean

    Returns true if an image is selected, or a video file has been loaded and is ready for decoding, false otherwise.

    isFaceImagePickingEnabled: boolean

    MediaPickerTextureProvider will allow users to select only images with detected faces through media picker UI. See also "cropFace" option.

    isImagePickingEnabled: boolean

    MediaPickerTextureProvider will allow users to select all images files through media picker UI.

    isVideoPickingEnabled: boolean

    MediaPickerTextureProvider will allow users to select video files through media picker UI.

    videoControl: VideoTextureProvider

    Returns underlying VideoTextureProvider for the last selected media file. If the last media file was not video, null is returned.

    Methods

    • Hides the image picker UI.

      Returns void

    • Returns true if the object matches or derives from the passed in type.

      Parameters

      • type: string

      Returns boolean

    • Binds a callback function for when the user selects or changes an image from the picker.

      Parameters

      • callback: () => void

      Returns void

    • Shows the image picker UI.

      Returns void

    MMNEPVFCICPMFPCPTTAAATR