2002-10-12 11:37:38 +00:00
|
|
|
/*
|
2008-01-07 19:13:47 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +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
|
2008-01-07 19:13:47 +00:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* 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,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 11:37:38 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
*
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
*
|
2008-01-07 19:13:47 +00:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 11:37:38 +00:00
|
|
|
*/
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __BLO_READFILE_H__
|
|
|
|
#define __BLO_READFILE_H__
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2011-02-17 23:34:07 +00:00
|
|
|
/** \file BLO_readfile.h
|
2011-02-27 20:35:41 +00:00
|
|
|
* \ingroup blenloader
|
2011-02-17 23:34:07 +00:00
|
|
|
* \brief external readfile function prototypes.
|
|
|
|
*/
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
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
|
|
|
struct BlendThumbnail;
|
2008-12-19 00:50:21 +00:00
|
|
|
struct bScreen;
|
2002-10-12 11:37:38 +00:00
|
|
|
struct LinkNode;
|
|
|
|
struct Main;
|
2004-09-05 13:43:51 +00:00
|
|
|
struct MemFile;
|
2008-12-19 00:50:21 +00:00
|
|
|
struct ReportList;
|
|
|
|
struct Scene;
|
|
|
|
struct UserDef;
|
2015-10-12 15:07:07 +02:00
|
|
|
struct View3D;
|
2009-09-12 19:54:39 +00:00
|
|
|
struct bContext;
|
2011-05-18 19:42:30 +00:00
|
|
|
struct BHead;
|
|
|
|
struct FileData;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
typedef struct BlendHandle BlendHandle;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
typedef enum BlenFileType {
|
2012-05-12 20:39:39 +00:00
|
|
|
BLENFILETYPE_BLEND = 1,
|
|
|
|
BLENFILETYPE_PUB = 2,
|
|
|
|
BLENFILETYPE_RUNTIME = 3
|
2002-10-12 11:37:38 +00:00
|
|
|
} BlenFileType;
|
|
|
|
|
|
|
|
typedef struct BlendFileData {
|
2012-05-12 20:39:39 +00:00
|
|
|
struct Main *main;
|
|
|
|
struct UserDef *user;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
int fileflags;
|
2003-07-21 19:41:07 +00:00
|
|
|
int globalf;
|
2012-05-12 20:39:39 +00:00
|
|
|
char filename[1024]; /* 1024 = FILE_MAX */
|
2007-12-24 18:53:37 +00:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
struct bScreen *curscreen;
|
|
|
|
struct Scene *curscene;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
BlenFileType type;
|
2002-10-12 11:37:38 +00:00
|
|
|
} BlendFileData;
|
|
|
|
|
2015-10-12 14:21:34 +02:00
|
|
|
BlendFileData *BLO_read_from_file(const char *filepath, struct ReportList *reports);
|
|
|
|
BlendFileData *BLO_read_from_memory(const void *mem, int memsize, struct ReportList *reports);
|
2014-02-01 00:51:53 +11:00
|
|
|
BlendFileData *BLO_read_from_memfile(
|
|
|
|
struct Main *oldmain, const char *filename, struct MemFile *memfile,
|
|
|
|
struct ReportList *reports);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2015-10-12 14:21:34 +02:00
|
|
|
void BLO_blendfiledata_free(BlendFileData *bfd);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2015-10-12 14:21:34 +02:00
|
|
|
BlendHandle *BLO_blendhandle_from_file(const char *filepath, struct ReportList *reports);
|
|
|
|
BlendHandle *BLO_blendhandle_from_memory(const void *mem, int memsize);
|
2007-09-02 17:25:03 +00:00
|
|
|
|
2015-10-12 14:21:34 +02:00
|
|
|
struct LinkNode *BLO_blendhandle_get_datablock_names(BlendHandle *bh, int ofblocktype, int *tot_names);
|
|
|
|
struct LinkNode *BLO_blendhandle_get_previews(BlendHandle *bh, int ofblocktype, int *tot_prev);
|
2014-02-01 00:51:53 +11:00
|
|
|
struct LinkNode *BLO_blendhandle_get_linkable_groups(BlendHandle *bh);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2015-10-12 14:21:34 +02:00
|
|
|
void BLO_blendhandle_close(BlendHandle *bh);
|
2014-02-01 00:51:53 +11:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
/***/
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2014-02-01 00:51:53 +11:00
|
|
|
#define BLO_GROUP_MAX 32
|
2009-09-12 19:54:39 +00:00
|
|
|
|
2014-01-31 03:09:01 +11:00
|
|
|
bool BLO_has_bfile_extension(const char *str);
|
2015-08-18 13:18:50 +02:00
|
|
|
bool BLO_library_path_explode(const char *path, char *r_dir, char **r_group, char **r_name);
|
2009-09-12 19:54:39 +00:00
|
|
|
|
2015-10-12 14:21:34 +02:00
|
|
|
struct Main *BLO_library_link_begin(struct Main *mainvar, BlendHandle **bh, const char *filepath);
|
|
|
|
struct ID *BLO_library_link_named_part(struct Main *mainl, BlendHandle **bh, const char *idname, const int idcode);
|
2015-10-12 13:46:58 +02:00
|
|
|
struct ID *BLO_library_link_named_part_ex(
|
2015-10-12 15:07:07 +02:00
|
|
|
struct Main *mainl, BlendHandle **bh,
|
|
|
|
const char *idname, const int idcode, const short flag,
|
|
|
|
struct Scene *scene, struct View3D *v3d);
|
|
|
|
void BLO_library_link_end(struct Main *mainl, BlendHandle **bh, short flag, struct Scene *scene, struct View3D *v3d);
|
2009-09-12 19:54:39 +00:00
|
|
|
|
2015-10-12 13:46:58 +02:00
|
|
|
void BLO_library_link_all(struct Main *mainl, BlendHandle *bh);
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
|
2011-05-18 19:42:30 +00:00
|
|
|
void *BLO_library_read_struct(struct FileData *fd, struct BHead *bh, const char *blockname);
|
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
BlendFileData *blo_read_blendafterruntime(int file, const char *name, int actualsize, struct ReportList *reports);
|
2014-02-01 00:51:53 +11:00
|
|
|
|
2012-09-15 01:52:28 +00:00
|
|
|
/* internal function but we need to expose it */
|
|
|
|
void blo_lib_link_screen_restore(struct Main *newmain, struct bScreen *curscreen, struct Scene *curscene);
|
|
|
|
|
2015-10-12 14:31:47 +02:00
|
|
|
typedef void (*BLOExpandDoitCallback) (void *fdhandle, struct Main *mainvar, void *idv);
|
|
|
|
|
|
|
|
void BLO_main_expander(BLOExpandDoitCallback expand_doit_func);
|
Holiday coding log :)
Nice formatted version (pictures soon):
http://wiki.blender.org/index.php/Dev:Ref/Release_Notes/2.66/Usability
Short list of main changes:
- Transparent region option (over main region), added code to blend in/out such panels.
- Min size window now 640 x 480
- Fixed DPI for ui - lots of cleanup and changes everywhere. Icon image need correct size still, layer-in-use icon needs remake.
- Macbook retina support, use command line --no-native-pixels to disable it
- Timeline Marker label was drawing wrong
- Trackpad and magic mouse: supports zoom (hold ctrl)
- Fix for splash position: removed ghost function and made window size update after creation immediate
- Fast undo buffer save now adds UI as well. Could be checked for regular file save even...
Quit.blend and temp file saving use this now.
- Dixed filename in window on reading quit.blend or temp saves, and they now add a warning in window title: "(Recovered)"
- New Userpref option "Keep Session" - this always saves quit.blend, and loads on start.
This allows keeping UI and data without actual saves, until you actually save.
When you load startup.blend and quit, it recognises the quit.blend as a startup (no file name in header)
- Added 3D view copy/paste buffers (selected objects). Shortcuts ctrl-c, ctrl-v (OSX, cmd-c, cmd-v).
Coded partial file saving for it. Could be used for other purposes. Todo: use OS clipboards.
- User preferences (themes, keymaps, user settings) now can be saved as a separate file.
Old option is called "Save Startup File" the new one "Save User Settings".
To visualise this difference, the 'save startup file' button has been removed from user preferences window. That option is available as CTRL+U and in File menu still.
- OSX: fixed bug that stopped giving mouse events outside window.
This also fixes "Continuous Grab" for OSX. (error since 2009)
2012-12-12 18:58:11 +00:00
|
|
|
void BLO_expand_main(void *fdhandle, struct Main *mainvar);
|
2013-09-10 13:25:35 +00:00
|
|
|
|
2014-07-23 20:20:59 +10:00
|
|
|
/* Update defaults in startup.blend & userprefs.blend, without having to save and embed it */
|
|
|
|
void BLO_update_defaults_userpref_blend(void);
|
2013-09-10 13:25:35 +00:00
|
|
|
void BLO_update_defaults_startup_blend(struct Main *mainvar);
|
|
|
|
|
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
|
|
|
struct BlendThumbnail *BLO_thumbnail_from_file(const char *filepath);
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-02-01 00:51:53 +11:00
|
|
|
#endif /* __BLO_READFILE_H__ */
|