[Bf-blender-cvs] [12b621059a6] master: Cleanup/refactor: remove BKE_idcode, in favour of BKE_idtype.
Bastien Montagne
noreply at git.blender.org
Thu Mar 19 19:42:31 CET 2020
Commit: 12b621059a6f1337e8ae8fdd9533e7808225e71e
Author: Bastien Montagne
Date: Thu Mar 19 19:37:00 2020 +0100
Branches: master
https://developer.blender.org/rB12b621059a6f1337e8ae8fdd9533e7808225e71e
Cleanup/refactor: remove BKE_idcode, in favour of BKE_idtype.
Mpving utils from idcode to idtype proved to be somewhat painful for
some reasons, but now all looks good.
Had to add a fake/empty shell for the special snowflake too,
`ID_LINK_PLACEHOLDER/INDEX_ID_NULL`...
===================================================================
D source/blender/blenkernel/BKE_idcode.h
M source/blender/blenkernel/BKE_idtype.h
M source/blender/blenkernel/CMakeLists.txt
D source/blender/blenkernel/intern/idcode.c
M source/blender/blenkernel/intern/idprop_utils.c
M source/blender/blenkernel/intern/idtype.c
M source/blender/blenkernel/intern/lib_id.c
M source/blender/blenkernel/intern/main_idmap.c
M source/blender/blenkernel/intern/mesh.c
M source/blender/blenkernel/intern/modifier.c
M source/blender/blenloader/intern/readblenentry.c
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/writefile.c
M source/blender/depsgraph/intern/builder/deg_builder_nodes.cc
M source/blender/depsgraph/intern/depsgraph.cc
M source/blender/depsgraph/intern/depsgraph_query.cc
M source/blender/depsgraph/intern/depsgraph_tag.cc
M source/blender/editors/animation/keyframing.c
M source/blender/editors/interface/interface_eyedropper_datablock.c
M source/blender/editors/interface/interface_templates.c
M source/blender/editors/object/object_transform.c
M source/blender/editors/space_file/filelist.c
M source/blender/editors/space_outliner/outliner_draw.c
M source/blender/editors/space_outliner/outliner_edit.c
M source/blender/editors/space_outliner/outliner_tree.c
M source/blender/imbuf/intern/thumbs_blend.c
M source/blender/makesrna/intern/rna_access.c
M source/blender/makesrna/intern/rna_main_api.c
M source/blender/python/intern/bpy_library_load.c
M source/blender/python/intern/bpy_rna.c
M source/blender/python/intern/bpy_rna_anim.c
M source/blender/windowmanager/intern/wm_dragdrop.c
M source/blender/windowmanager/intern/wm_files_link.c
M source/blender/windowmanager/intern/wm_operators.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_idcode.h b/source/blender/blenkernel/BKE_idcode.h
deleted file mode 100644
index 067143e3253..00000000000
--- a/source/blender/blenkernel/BKE_idcode.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- */
-
-#ifndef __BKE_IDCODE_H__
-#define __BKE_IDCODE_H__
-
-/** \file
- * \ingroup bke
- */
-
-#include "BLI_sys_types.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-const char *BKE_idcode_to_name(short idcode);
-const char *BKE_idcode_to_name_plural(short idcode);
-const char *BKE_idcode_to_translation_context(short idcode);
-short BKE_idcode_from_name(const char *name);
-bool BKE_idcode_is_linkable(short idcode);
-bool BKE_idcode_is_valid(short idcode);
-
-uint64_t BKE_idcode_to_idfilter(const short idcode);
-short BKE_idcode_from_idfilter(const uint64_t idfilter);
-
-int BKE_idcode_to_index(const short idcode);
-short BKE_idcode_from_index(const int index);
-
-short BKE_idcode_iter_step(int *index);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/source/blender/blenkernel/BKE_idtype.h b/source/blender/blenkernel/BKE_idtype.h
index 60eee2035f5..93bcfe5323d 100644
--- a/source/blender/blenkernel/BKE_idtype.h
+++ b/source/blender/blenkernel/BKE_idtype.h
@@ -166,6 +166,8 @@ extern IDTypeInfo IDType_ID_HA;
extern IDTypeInfo IDType_ID_PT;
extern IDTypeInfo IDType_ID_VO;
+extern IDTypeInfo IDType_ID_LINK_PLACEHOLDER;
+
/* ********** Helpers/Utils API. ********** */
/* Module initialization. */
@@ -175,6 +177,22 @@ void BKE_idtype_init(void);
const struct IDTypeInfo *BKE_idtype_get_info_from_idcode(const short id_code);
const struct IDTypeInfo *BKE_idtype_get_info_from_id(const struct ID *id);
+const char *BKE_idtype_idcode_to_name(const short idcode);
+const char *BKE_idtype_idcode_to_name_plural(const short idcode);
+const char *BKE_idtype_idcode_to_translation_context(const short idcode);
+bool BKE_idtype_idcode_is_linkable(const short idcode);
+bool BKE_idtype_idcode_is_valid(const short idcode);
+
+short BKE_idtype_idcode_from_name(const char *name);
+
+uint64_t BKE_idtype_idcode_to_idfilter(const short idcode);
+short BKE_idtype_idcode_from_idfilter(const uint64_t idfilter);
+
+int BKE_idtype_idcode_to_index(const short idcode);
+short BKE_idtype_idcode_from_index(const int index);
+
+short BKE_idtype_idcode_iter_step(int *index);
+
#ifdef __cplusplus
}
#endif
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 37e00b56fd9..1e230e5af3a 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -124,7 +124,6 @@ set(SRC
intern/hair.c
intern/icons.c
intern/icons_rasterize.c
- intern/idcode.c
intern/idprop.c
intern/idprop_utils.c
intern/idtype.c
@@ -304,7 +303,6 @@ set(SRC
BKE_gpencil_modifier.h
BKE_hair.h
BKE_icons.h
- BKE_idcode.h
BKE_idprop.h
BKE_idtype.h
BKE_image.h
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
deleted file mode 100644
index 454be246ad9..00000000000
--- a/source/blender/blenkernel/intern/idcode.c
+++ /dev/null
@@ -1,432 +0,0 @@
-/*
- * 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.
- *
- * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
- * All rights reserved.
- * return info about ID types
- */
-
-/** \file
- * \ingroup bke
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include "DNA_ID.h"
-
-#include "BLI_utildefines.h"
-
-#include "BLT_translation.h"
-
-#include "BKE_idcode.h"
-#include "BKE_main.h"
-
-typedef struct {
- unsigned short code;
- const char *name, *plural;
-
- const char *i18n_context;
-
- int flags;
-#define IDTYPE_FLAGS_ISLINKABLE (1 << 0)
-} IDType;
-
-/* Keep alignment for readability. */
-/* clang-format off */
-/**
- * When editing ensure that:
- * - Plural needs to match rna_main.c's #MainCollectionDef.
- * - Keep it in sync with i18n contexts in BLT_translation.h
- */
-static IDType idtypes[] = {
- /** ID's directly below must all be in #Main, and be kept in sync with #MAX_LIBARRAY (membership, not order) */
- {ID_AC, "Action", "actions", BLT_I18NCONTEXT_ID_ACTION, IDTYPE_FLAGS_ISLINKABLE},
- {ID_AR, "Armature", "armatures", BLT_I18NCONTEXT_ID_ARMATURE, IDTYPE_FLAGS_ISLINKABLE},
- {ID_BR, "Brush", "brushes", BLT_I18NCONTEXT_ID_BRUSH, IDTYPE_FLAGS_ISLINKABLE},
- {ID_CA, "Camera", "cameras", BLT_I18NCONTEXT_ID_CAMERA, IDTYPE_FLAGS_ISLINKABLE},
- {ID_CF, "CacheFile", "cache_files", BLT_I18NCONTEXT_ID_CACHEFILE, IDTYPE_FLAGS_ISLINKABLE},
- {ID_GR, "Collection", "collections", BLT_I18NCONTEXT_ID_COLLECTION, IDTYPE_FLAGS_ISLINKABLE},
- {ID_CU, "Curve", "curves", BLT_I18NCONTEXT_ID_CURVE, IDTYPE_FLAGS_ISLINKABLE},
- {ID_GD, "GPencil", "grease_pencils", BLT_I18NCONTEXT_ID_GPENCIL, IDTYPE_FLAGS_ISLINKABLE}, /* rename gpencil */
- {ID_HA, "Hair", "hair", BLT_I18NCONTEXT_ID_HAIR, IDTYPE_FLAGS_ISLINKABLE},
- {ID_IM, "Image", "images", BLT_I18NCONTEXT_ID_IMAGE, IDTYPE_FLAGS_ISLINKABLE},
- {ID_IP, "Ipo", "ipos", "", IDTYPE_FLAGS_ISLINKABLE}, /* deprecated */
- {ID_KE, "Key", "shape_keys", BLT_I18NCONTEXT_ID_SHAPEKEY, 0 },
- {ID_LA, "Light", "lights", BLT_I18NCONTEXT_ID_LIGHT, IDTYPE_FLAGS_ISLINKABLE},
- {ID_LI, "Library", "libraries", BLT_I18NCONTEXT_ID_LIBRARY, 0 },
- {ID_LS, "FreestyleLineStyle", "linestyles", BLT_I18NCONTEXT_ID_FREESTYLELINESTYLE, IDTYPE_FLAGS_ISLINKABLE},
- {ID_LT, "Lattice", "lattices", BLT_I18NCONTEXT_ID_LATTICE, IDTYPE_FLAGS_ISLINKABLE},
- {ID_MA, "Material", "materials", BLT_I18NCONTEXT_ID_MATERIAL, IDTYPE_FLAGS_ISLINKABLE},
- {ID_MB, "Metaball", "metaballs", BLT_I18NCONTEXT_ID_METABALL, IDTYPE_FLAGS_ISLINKABLE},
- {ID_MC, "MovieClip", "movieclips", BLT_I18NCONTEXT_ID_MOVIECLIP, IDTYPE_FLAGS_ISLINKABLE},
- {ID_ME, "Mesh", "meshes", BLT_I18NCONTEXT_ID_MESH, IDTYPE_FLAGS_ISLINKABLE},
- {ID_MSK, "Mask", "masks", BLT_I18NCONTEXT_ID_MASK, IDTYPE_FLAGS_ISLINKABLE},
- {ID_NT, "NodeTree", "node_groups", BLT_I18NCONTEXT_ID_NODETREE, IDTYPE_FLAGS_ISLINKABLE},
- {ID_OB, "Object", "objects", BLT_I18NCONTEXT_ID_OBJECT, IDTYPE_FLAGS_ISLINKABLE},
- {ID_PA, "ParticleSettings", "particles", BLT_I18NCONTEXT_ID_PARTICLESETTINGS, IDTYPE_FLAGS_ISLINKABLE},
- {ID_PAL, "Palettes", "palettes", BLT_I18NCONTEXT_ID_PALETTE, IDTYPE_FLAGS_ISLINKABLE},
- {ID_PC, "PaintCurve", "paint_curves", BLT_I18NCONTEXT_ID_PAINTCURVE, IDTYPE_FLAGS_ISLINKABLE},
- {ID_LP, "LightProbe", "lightprobes", BLT_I18NCONTEXT_ID_LIGHTPROBE, IDTYPE_FLAGS_ISLINKABLE},
- {ID_PT, "PointCloud", "pointclouds", BLT_I18NCONTEXT_ID_POINTCLOUD, IDTYPE_FLAGS_ISLINKABLE},
- {ID_SCE, "Scene", "scenes", BLT_I18NCONTEXT_ID_SCENE, IDTYPE_FLAGS_ISLINKABLE},
- {ID_SCR, "Screen", "screens", BLT_I18NCONTEXT_ID_SCREEN, IDTYPE_FLAGS_ISLINKABLE},
- {ID_SEQ, "Sequence", "sequences", BLT_I18NCONTEXT_ID_SEQUENCE, 0 }, /* not actually ID data */
- {ID_SPK, "Speaker", "speakers", BLT_I18NCONTEXT_ID_SPEAKER, IDTYPE_FLAGS_ISLINKABLE},
- {ID_SO, "Sound", "sounds", BLT_I18NCONTEXT_ID_SOUND, IDTYPE_FLAGS_ISLINKABLE},
- {ID_TE, "Texture", "textures", BLT_I18NCONTEXT_ID_TEXTURE, IDTYPE_FLAGS_ISLINKABLE},
- {ID_TXT, "Text", "texts", BLT_I18NCONTEXT_ID_TEXT, IDTYPE_FLAGS_ISLINKABLE},
- {ID_VF, "VFont", "fonts", BLT_I18NCONTEXT_ID_VFONT, IDTYPE_FLAGS_ISLINKABLE},
- {ID_VO, "Volume", "volumes", BLT_I18NCONTEXT_ID_VOLUME, IDTYPE_FLAGS_ISLINKABLE},
- {ID_WO, "World", "worlds", BLT_I18NCONTEXT_ID_WORLD, IDTYPE_FLAGS_ISLINKABLE},
- {ID_WM, "WindowManager", "window_managers", BLT_I1
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list