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
* Contributor(s): Campbell Barton
20
* ***** END GPL LICENSE BLOCK *****
26
#include "BLI_utildefines.h"
27
#include "BLI_ghash.h"
28
#include "BLI_string.h"
30
#include "BKE_addon.h" /* own include */
32
#include "RNA_access.h"
33
#include "RNA_define.h"
35
#include "BLF_translation.h"
37
#include "MEM_guardedalloc.h"
39
static GHash *global_addonpreftype_hash = NULL;
42
bAddonPrefType *BKE_addon_pref_type_find(const char *idname, int quiet)
47
apt = BLI_ghash_lookup(global_addonpreftype_hash, idname);
53
printf("search for unknown addon-pref '%s'\n", idname);
58
printf("search for empty addon-pref");
65
void BKE_addon_pref_type_add(bAddonPrefType *apt)
67
BLI_ghash_insert(global_addonpreftype_hash, (void *)apt->idname, apt);
70
void BKE_addon_pref_type_remove(bAddonPrefType *apt)
72
BLI_ghash_remove(global_addonpreftype_hash, (void *)apt->idname, NULL, (GHashValFreeFP)MEM_freeN);
75
void BKE_addon_pref_type_init(void)
77
BLI_assert(global_addonpreftype_hash == NULL);
78
global_addonpreftype_hash = BLI_ghash_str_new(__func__);
81
void BKE_addon_pref_type_free(void)
83
BLI_ghash_free(global_addonpreftype_hash, NULL, (GHashValFreeFP)MEM_freeN);
84
global_addonpreftype_hash = NULL;