2012-09-03 10:12:25 +00:00
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
#ifndef __BLO_BLEND_DEFS_H__
|
|
|
|
#define __BLO_BLEND_DEFS_H__
|
|
|
|
|
2019-02-18 08:08:12 +11:00
|
|
|
/** \file
|
|
|
|
* \ingroup blenloader
|
|
|
|
* \brief defines for blendfile codes
|
2012-09-03 10:12:25 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/* INTEGER CODES */
|
|
|
|
#ifdef __BIG_ENDIAN__
|
|
|
|
/* Big Endian */
|
|
|
|
# define BLEND_MAKE_ID(a, b, c, d) ( (int)(a) << 24 | (int)(b) << 16 | (c) << 8 | (d) )
|
|
|
|
#else
|
|
|
|
/* Little Endian */
|
|
|
|
# define BLEND_MAKE_ID(a, b, c, d) ( (int)(d) << 24 | (int)(c) << 16 | (b) << 8 | (a) )
|
|
|
|
#endif
|
|
|
|
|
2015-08-14 17:30:32 +10:00
|
|
|
/**
|
|
|
|
* Codes used for #BHead.code.
|
|
|
|
*
|
|
|
|
* These coexist with ID codes such as #ID_OB, #ID_SCE ... etc.
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
/**
|
|
|
|
* Arbitrary allocated memory
|
2015-08-21 09:07:52 +10:00
|
|
|
* (typically owned by #ID's, will be freed when there are no users).
|
2015-08-14 17:30:32 +10:00
|
|
|
*/
|
|
|
|
DATA = BLEND_MAKE_ID('D', 'A', 'T', 'A'),
|
|
|
|
/**
|
|
|
|
* Used for #Global struct.
|
|
|
|
*/
|
|
|
|
GLOB = BLEND_MAKE_ID('G', 'L', 'O', 'B'),
|
|
|
|
/**
|
|
|
|
* Used for storing the encoded SDNA string
|
|
|
|
* (decoded into an #SDNA on load).
|
|
|
|
*/
|
|
|
|
DNA1 = BLEND_MAKE_ID('D', 'N', 'A', '1'),
|
|
|
|
/**
|
2015-08-21 09:07:52 +10:00
|
|
|
* Used to store thumbnail previews, written between #REND and #GLOB blocks,
|
|
|
|
* (ignored for regular file reading).
|
2015-08-14 17:30:32 +10:00
|
|
|
*/
|
|
|
|
TEST = BLEND_MAKE_ID('T', 'E', 'S', 'T'),
|
|
|
|
/**
|
|
|
|
* Used for #RenderInfo, basic Scene and frame range info,
|
|
|
|
* can be easily read by other applications without writing a full blend file parser.
|
|
|
|
*/
|
|
|
|
REND = BLEND_MAKE_ID('R', 'E', 'N', 'D'),
|
|
|
|
/**
|
|
|
|
* Used for #UserDef, (user-preferences data).
|
|
|
|
* (written to #BLENDER_STARTUP_FILE & #BLENDER_USERPREF_FILE).
|
|
|
|
*/
|
|
|
|
USER = BLEND_MAKE_ID('U', 'S', 'E', 'R'),
|
|
|
|
/**
|
|
|
|
* Terminate reading (no data).
|
|
|
|
*/
|
|
|
|
ENDB = BLEND_MAKE_ID('E', 'N', 'D', 'B'),
|
|
|
|
};
|
2012-09-03 10:12:25 +00:00
|
|
|
|
2018-01-14 23:26:31 +01:00
|
|
|
#define BLEN_THUMB_MEMSIZE_FILE(_x, _y) (sizeof(int) * (2 + (size_t)(_x) * (size_t)(_y)))
|
Make .blend file thumbnail reading simpler and more coherent, read/store them when reading in background mode.
Primary goal of this commit is to fix an annoying issue - when processing and saving .blend
files in background mode you lose their thumbnails, since it can only be generated with
an OpenGL context.
Solution to that is to read .blend thumbnail while reading .blend file (only done in background
mode currently), and store it in Main struct.
Also, this lead to removing .blend file reading code from thumb_blend (no need to have doublons).
We now have a small interface in regular reading code area, which keeps it reasonbaly light
by only reading/parsing header info, and first few BHead blocks.
This makes code reading .blend thumbnail about 3 to 4 times slower than previous highly specialized
one in blend_thumb.c, but overall thumbnail generation of a big .blend files folder only grows
of about 1%, think we can bare with it.
Finally, since thumbnail is now optionally stored in Main struct, it makes it easy to allow user
to define their own custom one (instead of auto-generated one). RNA API for this was not added though,
accessing that kind of .blend meta-data has to be rethought a bit on a bigger level first.
Reviewers: sergey, campbellbarton
Subscribers: Severin, psy-fi
Differential Revision: https://developer.blender.org/D1469
2015-08-27 15:53:23 +02:00
|
|
|
|
2012-09-03 10:12:25 +00:00
|
|
|
#endif /* __BLO_BLEND_DEFS_H__ */
|