2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19 * All rights reserved.
21 * The Original Code is: all of this file.
23 * Contributor(s): none yet.
25 * ***** END GPL LICENSE BLOCK *****
27 #ifndef __BKE_LIBRARY_H__
28 #define __BKE_LIBRARY_H__
30 /** \file BKE_library.h
43 struct wmWindowManager;
48 void *BKE_libblock_alloc(struct ListBase *lb, short type, const char *name);
49 void *BKE_libblock_copy(struct ID *id);
50 void BKE_libblock_copy_data(struct ID *id, const struct ID *id_from, const short do_action);
52 void BKE_id_lib_local_paths(struct Main *bmain, struct Library *lib, struct ID *id);
53 void id_lib_extern(struct ID *id);
54 void BKE_library_filepath_set(struct Library *lib, const char *filepath);
55 void id_us_plus(struct ID *id);
56 void id_us_min(struct ID *id);
58 int id_make_local(struct ID *id, int test);
59 int id_single_user(struct bContext *C, struct ID *id, struct PointerRNA *ptr, struct PropertyRNA *prop);
60 int id_copy(struct ID *id, struct ID **newid, int test);
61 int id_unlink(struct ID *id, int test);
62 void id_sort_by_name(struct ListBase *lb, struct ID *id);
64 int new_id(struct ListBase *lb, struct ID *id, const char *name);
65 void id_clear_lib_data(struct Main *bmain, struct ID *id);
67 struct ListBase *which_libbase(struct Main *mainlib, short type);
69 #define MAX_LIBARRAY 41
70 int set_listbasepointers(struct Main *main, struct ListBase **lb);
72 void BKE_libblock_free(struct ListBase *lb, void *idv);
73 void BKE_libblock_free_us(struct ListBase *lb, void *idv);
74 void free_main(struct Main *mainvar);
76 void tag_main_idcode(struct Main *mainvar, const short type, const short tag);
77 void tag_main_lb(struct ListBase *lb, const short tag);
78 void tag_main(struct Main *mainvar, const short tag);
80 void rename_id(struct ID *id, const char *name);
81 void name_uiprefix_id(char *name, struct ID *id);
82 void test_idbutton(char *name);
83 void text_idbutton(struct ID *id, char *text);
84 void BKE_library_make_local(struct Main *bmain, struct Library *lib, int untagged_only);
85 struct ID *BKE_libblock_find_name(const short type, const char *name);
86 void clear_id_newpoins(void);
88 void IDnames_to_pupstring(const char **str, const char *title, const char *extraops,
89 struct ListBase *lb, struct ID *link, short *nr);
90 void IMAnames_to_pupstring(const char **str, const char *title, const char *extraops,
91 struct ListBase *lb, struct ID *link, short *nr);
93 void flag_listbase_ids(ListBase *lb, short flag, short value);
94 void flag_all_listbases_ids(short flag, short value);
95 void recalc_all_library_objects(struct Main *main);
97 void set_free_windowmanager_cb(void (*func)(struct bContext *, struct wmWindowManager *) );
99 /* use when "" is given to new_id() */
100 #define ID_FALLBACK_NAME "Untitled"
102 #define IS_TAGGED(_id) ((_id) && (((ID *)_id)->flag & LIB_DOIT))