Blender  V3.3
Functions
blender_thumbnailer.cc File Reference
#include <fstream>
#include <optional>
#include <fcntl.h>
#include <unistd.h>
#include "BLI_fileops.h"
#include "BLI_filereader.h"
#include "BLI_vector.hh"
#include "blendthumb.hh"

Go to the source code of this file.

Functions

static eThumbStatus extract_png_from_blend_file (const char *src_blend, const char *dst_png)
 
int main (int argc, char *argv[])
 

Detailed Description

This file defines the thumbnail generation command (typically used on UNIX).

To run automatically with a file manager such as Nautilus, save this file in a directory that is listed in PATH environment variable, and create blender.thumbnailer file in ${HOME}/.local/share/thumbnailers/ directory with the following contents:

[Thumbnailer Entry]
TryExec=blender-thumbnailer
Exec=blender-thumbnailer %u %o
MimeType=application/x-blender;
struct Entry Entry

Definition in file blender_thumbnailer.cc.

Function Documentation

◆ extract_png_from_blend_file()

static eThumbStatus extract_png_from_blend_file ( const char *  src_blend,
const char *  dst_png 
)
static

This function opens .blend file from src_blend, extracts thumbnail from file if there is one, and writes .png image into dst_png. Returns exit code (0 if successful).

Definition at line 44 of file blender_thumbnailer.cc.

References blendthumb_create_png_data_from_thumb(), blendthumb_create_thumb_from_file(), BLI_filereader_new_file(), BLI_open(), BT_ERROR, BT_FILE_ERR, BT_OK, blender::Vector< T, InlineBufferCapacity, Allocator >::data(), err, file, O_BINARY, and blender::Vector< T, InlineBufferCapacity, Allocator >::size().

Referenced by main().

◆ main()

int main ( int  argc,
char *  argv[] 
)