2011-02-18 14:05:18 +01:00
|
|
|
/*
|
2008-01-07 20:13:47 +01:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
2002-10-12 13:37:38 +02: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 20:13:47 +01:00
|
|
|
* of the License, or (at your option) any later version.
|
2002-10-12 13:37:38 +02: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 14:34:04 +01:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2002-10-12 13:37:38 +02: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 20:13:47 +01:00
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
2002-10-12 13:37:38 +02:00
|
|
|
*/
|
2012-02-17 19:59:41 +01:00
|
|
|
#ifndef __BKE_LIBRARY_H__
|
|
|
|
#define __BKE_LIBRARY_H__
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2011-02-18 14:05:18 +01:00
|
|
|
/** \file BKE_library.h
|
|
|
|
* \ingroup bke
|
|
|
|
* \since March 2001
|
|
|
|
* \author nzc
|
|
|
|
*/
|
2010-10-05 02:05:14 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2013-09-01 17:01:15 +02:00
|
|
|
#include "BLI_compiler_attrs.h"
|
|
|
|
|
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;
|
2002-10-12 13:37:38 +02:00
|
|
|
struct ListBase;
|
|
|
|
struct ID;
|
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 ImBuf;
|
2002-10-12 13:37:38 +02:00
|
|
|
struct Main;
|
|
|
|
struct Library;
|
2007-12-24 19:38:03 +01:00
|
|
|
struct wmWindowManager;
|
|
|
|
struct bContext;
|
2011-06-29 06:34:20 +02:00
|
|
|
struct PointerRNA;
|
|
|
|
struct PropertyRNA;
|
2002-10-12 13:37:38 +02:00
|
|
|
|
First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.
That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.
Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.
Future plans are also to be able to relocate missing libs and reload them at runtime.
Code notes:
- Placeholder ID is just a regular datablock of same type as expected linked one,
with 'default' data, and a LIB_MISSING bitflag set.
- To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
+ Allocation of memory itself.
+ Setting of all internal data to default values.
See also the design task (T43351).
Reviewed by @campbellbarton, thanks a bunch!
Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
|
|
|
void *BKE_libblock_alloc_notest(short type);
|
2014-01-15 16:37:03 +01:00
|
|
|
void *BKE_libblock_alloc(struct Main *bmain, short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
First step to handle missing libs/datablocks when reading a file.
Idea is, instead of ignoring completely missing linked datablocks, to
create void placeholders for them.
That way, you can work on your file, save it, and find again your missing data once
lib becomes available again. Or you can edit missing lib's path (in Outliner),
save and reload the file, and you are done.
Also, Outliner now shows broken libraries (and placeholders) with a 'broken lib' icon.
Future plans are also to be able to relocate missing libs and reload them at runtime.
Code notes:
- Placeholder ID is just a regular datablock of same type as expected linked one,
with 'default' data, and a LIB_MISSING bitflag set.
- To allow creation of such datablocks, creation of datablocks in BKE was split in two step:
+ Allocation of memory itself.
+ Setting of all internal data to default values.
See also the design task (T43351).
Reviewed by @campbellbarton, thanks a bunch!
Differential Revision: https://developer.blender.org/D1394
2015-10-20 14:44:57 +02:00
|
|
|
void BKE_libblock_init_empty(struct ID *id);
|
2013-09-01 17:01:15 +02:00
|
|
|
void *BKE_libblock_copy_ex(struct Main *bmain, struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
2014-05-09 14:59:14 +02:00
|
|
|
void *BKE_libblock_copy_nolib(struct ID *id, const bool do_action) ATTR_NONNULL();
|
2013-09-01 17:01:15 +02:00
|
|
|
void *BKE_libblock_copy(struct ID *id) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
2013-03-10 06:46:24 +01:00
|
|
|
void BKE_libblock_copy_data(struct ID *id, const struct ID *id_from, const bool do_action);
|
2015-10-08 11:29:49 +02:00
|
|
|
void BKE_libblock_relink(struct ID *id);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2011-11-30 01:32:13 +01:00
|
|
|
void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id);
|
2002-10-12 13:37:38 +02:00
|
|
|
void id_lib_extern(struct ID *id);
|
2011-10-23 19:52:20 +02:00
|
|
|
void BKE_library_filepath_set(struct Library *lib, const char *filepath);
|
2012-12-18 09:41:38 +01:00
|
|
|
void id_us_ensure_real(struct ID *id);
|
2002-10-12 13:37:38 +02:00
|
|
|
void id_us_plus(struct ID *id);
|
2009-05-27 02:03:49 +02:00
|
|
|
void id_us_min(struct ID *id);
|
2012-05-05 16:03:12 +02:00
|
|
|
|
2013-03-10 06:46:24 +01:00
|
|
|
bool id_make_local(struct ID *id, bool test);
|
|
|
|
bool id_single_user(struct bContext *C, struct ID *id, struct PointerRNA *ptr, struct PropertyRNA *prop);
|
|
|
|
bool id_copy(struct ID *id, struct ID **newid, bool test);
|
|
|
|
bool id_unlink(struct ID *id, int test);
|
2012-04-06 18:19:30 +02:00
|
|
|
void id_sort_by_name(struct ListBase *lb, struct ID *id);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2013-03-10 06:46:24 +01:00
|
|
|
bool new_id(struct ListBase *lb, struct ID *id, const char *name);
|
2011-10-26 23:22:35 +02:00
|
|
|
void id_clear_lib_data(struct Main *bmain, struct ID *id);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
* Multiply for panorama cameras
* Some cases of struct name being set where it shouldnt have been.
* Spelling: wich --> which
* Copy and initialize uv modifier scale, remove unneeded enum.
* Ability to pin any object into the context.
* Update uv window while transforming (useful when used with UVProject modifier)
* Patch by Wahooney, so new template's are internal text and dont get saved over
by mistake.
* Fix for https://bugzilla.redhat.com/show_bug.cgi?id=572186
Bug 572186 - [abrt] crash in blender-2.49b-5.fc12: Process
/usr/bin/blender.bin was killed by signal 6 (SIGABRT). Original fix submitted
by Jochen Schmitt.
* [#21816] bpy.data.add_image has stopped working on Windows. moved to
bpy.data.images.load(), missed this call.
(commits 27726,27825,27828,27831,27832,27833,27834,27836,27837,27838,27839,27858 by Campbell from render25 branch)
2010-03-30 14:15:16 +02:00
|
|
|
struct ListBase *which_libbase(struct Main *mainlib, short type);
|
2006-09-06 11:51:30 +02:00
|
|
|
|
2015-10-22 16:20:01 +02:00
|
|
|
#define MAX_LIBARRAY 34
|
2014-09-22 05:23:42 +02:00
|
|
|
int set_listbasepointers(struct Main *main, struct ListBase *lb[MAX_LIBARRAY]);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2014-01-15 16:37:03 +01:00
|
|
|
void BKE_libblock_free(struct Main *bmain, void *idv);
|
|
|
|
void BKE_libblock_free_ex(struct Main *bmain, void *idv, bool do_id_user);
|
|
|
|
void BKE_libblock_free_us(struct Main *bmain, void *idv);
|
2014-06-24 16:43:08 +02:00
|
|
|
void BKE_libblock_free_data(struct Main *bmain, struct ID *id);
|
2013-12-26 12:24:42 +01:00
|
|
|
|
2013-12-30 03:25:27 +01:00
|
|
|
|
|
|
|
/* Main API */
|
2013-12-26 12:24:42 +01:00
|
|
|
struct Main *BKE_main_new(void);
|
2013-12-30 03:25:27 +01:00
|
|
|
void BKE_main_free(struct Main *mainvar);
|
|
|
|
|
2014-06-26 10:55:40 +02:00
|
|
|
void BKE_main_lock(struct Main *bmain);
|
|
|
|
void BKE_main_unlock(struct Main *bmain);
|
|
|
|
|
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 *BKE_main_thumbnail_from_imbuf(struct Main *bmain, struct ImBuf *img);
|
|
|
|
struct ImBuf *BKE_main_thumbnail_to_imbuf(struct Main *bmain, struct BlendThumbnail *data);
|
|
|
|
void BKE_main_thumbnail_create(struct Main *bmain);
|
|
|
|
|
2013-12-30 03:25:27 +01:00
|
|
|
void BKE_main_id_tag_idcode(struct Main *mainvar, const short type, const bool tag);
|
|
|
|
void BKE_main_id_tag_listbase(struct ListBase *lb, const bool tag);
|
|
|
|
void BKE_main_id_tag_all(struct Main *mainvar, const bool tag);
|
|
|
|
|
|
|
|
void BKE_main_id_flag_listbase(ListBase *lb, const short flag, const bool value);
|
|
|
|
void BKE_main_id_flag_all(struct Main *bmain, const short flag, const bool value);
|
|
|
|
|
|
|
|
void BKE_main_id_clear_newpoins(struct Main *bmain);
|
2011-01-05 06:33:27 +01:00
|
|
|
|
2013-12-30 03:25:27 +01:00
|
|
|
void BKE_main_lib_objects_recalc_all(struct Main *bmain);
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2010-12-03 18:05:21 +01:00
|
|
|
void rename_id(struct ID *id, const char *name);
|
2013-03-10 06:46:24 +01:00
|
|
|
void name_uiprefix_id(char *name, const struct ID *id);
|
2002-10-12 13:37:38 +02:00
|
|
|
void test_idbutton(char *name);
|
2013-12-30 03:25:27 +01:00
|
|
|
|
2013-03-10 06:46:24 +01:00
|
|
|
void BKE_library_make_local(struct Main *bmain, struct Library *lib, bool untagged_only);
|
2013-12-30 03:25:27 +01:00
|
|
|
|
2014-07-23 12:20:59 +02:00
|
|
|
struct ID *BKE_libblock_find_name_ex(struct Main *bmain, const short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
2013-09-01 17:01:15 +02:00
|
|
|
struct ID *BKE_libblock_find_name(const short type, const char *name) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL();
|
2002-10-12 13:37:38 +02:00
|
|
|
|
2015-05-04 04:29:38 +02:00
|
|
|
void BKE_library_callback_free_window_manager_set(void (*func)(struct bContext *, struct wmWindowManager *));
|
|
|
|
void BKE_library_callback_free_notifier_reference_set(void (*func)(const void *));
|
2015-05-04 04:40:38 +02:00
|
|
|
void BKE_library_callback_free_editor_id_reference_set(void (*func)(const struct ID *));
|
2007-12-24 19:38:03 +01:00
|
|
|
|
2010-03-06 19:21:57 +01:00
|
|
|
/* use when "" is given to new_id() */
|
2013-03-25 09:29:06 +01:00
|
|
|
#define ID_FALLBACK_NAME N_("Untitled")
|
2010-03-06 19:21:57 +01:00
|
|
|
|
2010-12-20 08:21:08 +01:00
|
|
|
#define IS_TAGGED(_id) ((_id) && (((ID *)_id)->flag & LIB_DOIT))
|
|
|
|
|
2010-10-05 02:05:14 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-03-10 06:46:24 +01:00
|
|
|
#endif /* __BKE_LIBRARY_H__ */
|