Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2021-02-09 01:42:58 +0300
committerCampbell Barton <ideasman42@gmail.com>2021-02-09 01:58:06 +0300
commit3b1c7a6d6f2dfc4a72a1b33217366db6173d8d71 (patch)
tree23eb209623e842dc3d635f78a86d76420cd308f7
parentcfa48c84d06ca8197f86b6d3ceef8a2c7c311a82 (diff)
Cleanup: move eIconSizes, ID_Type enums into own file
This avoids adding DNA_ID.h into other headers, recently changed in cfa48c84d06ca8197f86b6d3ceef8a2c7c311a82 Note that other enums could be moved too, this is a smaller change to avoid indirectly including DNA_ID.h in many places.
-rw-r--r--source/blender/CMakeLists.txt1
-rw-r--r--source/blender/editors/include/UI_interface_icons.h4
-rw-r--r--source/blender/makesdna/DNA_ID.h89
-rw-r--r--source/blender/makesdna/DNA_ID_enums.h118
4 files changed, 122 insertions, 90 deletions
diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index efd30ba8509..f875a990d0a 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -20,6 +20,7 @@
set(SRC_DNA_INC
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_ID.h
+ ${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_ID_enums.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_action_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_anim_types.h
${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_armature_types.h
diff --git a/source/blender/editors/include/UI_interface_icons.h b/source/blender/editors/include/UI_interface_icons.h
index 4d860be285d..266a538b6c3 100644
--- a/source/blender/editors/include/UI_interface_icons.h
+++ b/source/blender/editors/include/UI_interface_icons.h
@@ -23,8 +23,8 @@
#pragma once
-/* Required for enum iconSizes which can't be forward declared if this file is included in C++. */
-#include "DNA_ID.h"
+/* Required for #eIconSizes which can't be forward declared if this file is included in C++. */
+#include "DNA_ID_enums.h"
#ifdef __cplusplus
extern "C" {
diff --git a/source/blender/makesdna/DNA_ID.h b/source/blender/makesdna/DNA_ID.h
index 26824216337..d9c821d3ba7 100644
--- a/source/blender/makesdna/DNA_ID.h
+++ b/source/blender/makesdna/DNA_ID.h
@@ -24,6 +24,7 @@
#pragma once
+#include "DNA_ID_enums.h"
#include "DNA_defs.h"
#include "DNA_listBase.h"
@@ -367,13 +368,6 @@ typedef struct Library {
short versionfile, subversionfile;
} Library;
-enum eIconSizes {
- ICON_SIZE_ICON = 0,
- ICON_SIZE_PREVIEW = 1,
-
- NUM_ICON_SIZES,
-};
-
/* for PreviewImage->flag */
enum ePreviewImage_Flag {
PRV_CHANGED = (1 << 0),
@@ -411,87 +405,6 @@ typedef struct PreviewImage {
BLI_assert((prv)->tag & PRV_TAG_DEFFERED), \
(void *)((prv) + 1))
-/**
- * Defines for working with IDs.
- *
- * The tags represent types! This is a dirty way of enabling RTTI. The
- * sig_byte end endian defines aren't really used much.
- */
-
-#ifdef __BIG_ENDIAN__
-/* big endian */
-# define MAKE_ID2(c, d) ((c) << 8 | (d))
-#else
-/* little endian */
-# define MAKE_ID2(c, d) ((d) << 8 | (c))
-#endif
-
-/**
- * ID from database.
- *
- * Written to #BHead.code (for file IO)
- * and the first 2 bytes of #ID.name (for runtime checks, see #GS macro).
- */
-typedef enum ID_Type {
- ID_SCE = MAKE_ID2('S', 'C'), /* Scene */
- ID_LI = MAKE_ID2('L', 'I'), /* Library */
- ID_OB = MAKE_ID2('O', 'B'), /* Object */
- ID_ME = MAKE_ID2('M', 'E'), /* Mesh */
- ID_CU = MAKE_ID2('C', 'U'), /* Curve */
- ID_MB = MAKE_ID2('M', 'B'), /* MetaBall */
- ID_MA = MAKE_ID2('M', 'A'), /* Material */
- ID_TE = MAKE_ID2('T', 'E'), /* Tex (Texture) */
- ID_IM = MAKE_ID2('I', 'M'), /* Image */
- ID_LT = MAKE_ID2('L', 'T'), /* Lattice */
- ID_LA = MAKE_ID2('L', 'A'), /* Light */
- ID_CA = MAKE_ID2('C', 'A'), /* Camera */
- ID_IP = MAKE_ID2('I', 'P'), /* Ipo (depreciated, replaced by FCurves) */
- ID_KE = MAKE_ID2('K', 'E'), /* Key (shape key) */
- ID_WO = MAKE_ID2('W', 'O'), /* World */
- ID_SCR = MAKE_ID2('S', 'R'), /* Screen */
- ID_VF = MAKE_ID2('V', 'F'), /* VFont (Vector Font) */
- ID_TXT = MAKE_ID2('T', 'X'), /* Text */
- ID_SPK = MAKE_ID2('S', 'K'), /* Speaker */
- ID_SO = MAKE_ID2('S', 'O'), /* Sound */
- ID_GR = MAKE_ID2('G', 'R'), /* Collection */
- ID_AR = MAKE_ID2('A', 'R'), /* bArmature */
- ID_AC = MAKE_ID2('A', 'C'), /* bAction */
- ID_NT = MAKE_ID2('N', 'T'), /* bNodeTree */
- ID_BR = MAKE_ID2('B', 'R'), /* Brush */
- ID_PA = MAKE_ID2('P', 'A'), /* ParticleSettings */
- ID_GD = MAKE_ID2('G', 'D'), /* bGPdata, (Grease Pencil) */
- ID_WM = MAKE_ID2('W', 'M'), /* WindowManager */
- ID_MC = MAKE_ID2('M', 'C'), /* MovieClip */
- ID_MSK = MAKE_ID2('M', 'S'), /* Mask */
- ID_LS = MAKE_ID2('L', 'S'), /* FreestyleLineStyle */
- ID_PAL = MAKE_ID2('P', 'L'), /* Palette */
- ID_PC = MAKE_ID2('P', 'C'), /* PaintCurve */
- ID_CF = MAKE_ID2('C', 'F'), /* CacheFile */
- ID_WS = MAKE_ID2('W', 'S'), /* WorkSpace */
- ID_LP = MAKE_ID2('L', 'P'), /* LightProbe */
- ID_HA = MAKE_ID2('H', 'A'), /* Hair */
- ID_PT = MAKE_ID2('P', 'T'), /* PointCloud */
- ID_VO = MAKE_ID2('V', 'O'), /* Volume */
- ID_SIM = MAKE_ID2('S', 'I'), /* Simulation (geometry node groups) */
-} ID_Type;
-
-/* Only used as 'placeholder' in .blend files for directly linked data-blocks. */
-#define ID_LINK_PLACEHOLDER MAKE_ID2('I', 'D') /* (internal use only) */
-
-/* Deprecated. */
-#define ID_SCRN MAKE_ID2('S', 'N')
-
-/* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */
-#define ID_SEQ MAKE_ID2('S', 'Q')
-/* constraint */
-#define ID_CO MAKE_ID2('C', 'O')
-/* pose (action channel, used to be ID_AC in code, so we keep code for backwards compat) */
-#define ID_PO MAKE_ID2('A', 'C')
-/* used in outliner... */
-#define ID_NLA MAKE_ID2('N', 'L')
-/* fluidsim Ipo */
-#define ID_FLUIDSIM MAKE_ID2('F', 'S')
-
#define ID_FAKE_USERS(id) ((((const ID *)id)->flag & LIB_FAKEUSER) ? 1 : 0)
#define ID_REAL_USERS(id) (((const ID *)id)->us - ID_FAKE_USERS(id))
#define ID_EXTRA_USERS(id) (((const ID *)id)->tag & LIB_TAG_EXTRAUSER ? 1 : 0)
diff --git a/source/blender/makesdna/DNA_ID_enums.h b/source/blender/makesdna/DNA_ID_enums.h
new file mode 100644
index 00000000000..c865c8ea973
--- /dev/null
+++ b/source/blender/makesdna/DNA_ID_enums.h
@@ -0,0 +1,118 @@
+/*
+ * 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.
+ */
+
+/** \file
+ * \ingroup DNA
+ * \brief Enumerations for `DNA_ID.h`.
+ */
+
+#pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+enum eIconSizes {
+ ICON_SIZE_ICON = 0,
+ ICON_SIZE_PREVIEW = 1,
+
+ NUM_ICON_SIZES,
+};
+
+/**
+ * Defines for working with IDs.
+ *
+ * The tags represent types! This is a dirty way of enabling RTTI. The
+ * sig_byte end endian defines aren't really used much.
+ */
+
+#ifdef __BIG_ENDIAN__
+/* big endian */
+# define MAKE_ID2(c, d) ((c) << 8 | (d))
+#else
+/* little endian */
+# define MAKE_ID2(c, d) ((d) << 8 | (c))
+#endif
+
+/**
+ * ID from database.
+ *
+ * Written to #BHead.code (for file IO)
+ * and the first 2 bytes of #ID.name (for runtime checks, see #GS macro).
+ */
+typedef enum ID_Type {
+ ID_SCE = MAKE_ID2('S', 'C'), /* Scene */
+ ID_LI = MAKE_ID2('L', 'I'), /* Library */
+ ID_OB = MAKE_ID2('O', 'B'), /* Object */
+ ID_ME = MAKE_ID2('M', 'E'), /* Mesh */
+ ID_CU = MAKE_ID2('C', 'U'), /* Curve */
+ ID_MB = MAKE_ID2('M', 'B'), /* MetaBall */
+ ID_MA = MAKE_ID2('M', 'A'), /* Material */
+ ID_TE = MAKE_ID2('T', 'E'), /* Tex (Texture) */
+ ID_IM = MAKE_ID2('I', 'M'), /* Image */
+ ID_LT = MAKE_ID2('L', 'T'), /* Lattice */
+ ID_LA = MAKE_ID2('L', 'A'), /* Light */
+ ID_CA = MAKE_ID2('C', 'A'), /* Camera */
+ ID_IP = MAKE_ID2('I', 'P'), /* Ipo (depreciated, replaced by FCurves) */
+ ID_KE = MAKE_ID2('K', 'E'), /* Key (shape key) */
+ ID_WO = MAKE_ID2('W', 'O'), /* World */
+ ID_SCR = MAKE_ID2('S', 'R'), /* Screen */
+ ID_VF = MAKE_ID2('V', 'F'), /* VFont (Vector Font) */
+ ID_TXT = MAKE_ID2('T', 'X'), /* Text */
+ ID_SPK = MAKE_ID2('S', 'K'), /* Speaker */
+ ID_SO = MAKE_ID2('S', 'O'), /* Sound */
+ ID_GR = MAKE_ID2('G', 'R'), /* Collection */
+ ID_AR = MAKE_ID2('A', 'R'), /* bArmature */
+ ID_AC = MAKE_ID2('A', 'C'), /* bAction */
+ ID_NT = MAKE_ID2('N', 'T'), /* bNodeTree */
+ ID_BR = MAKE_ID2('B', 'R'), /* Brush */
+ ID_PA = MAKE_ID2('P', 'A'), /* ParticleSettings */
+ ID_GD = MAKE_ID2('G', 'D'), /* bGPdata, (Grease Pencil) */
+ ID_WM = MAKE_ID2('W', 'M'), /* WindowManager */
+ ID_MC = MAKE_ID2('M', 'C'), /* MovieClip */
+ ID_MSK = MAKE_ID2('M', 'S'), /* Mask */
+ ID_LS = MAKE_ID2('L', 'S'), /* FreestyleLineStyle */
+ ID_PAL = MAKE_ID2('P', 'L'), /* Palette */
+ ID_PC = MAKE_ID2('P', 'C'), /* PaintCurve */
+ ID_CF = MAKE_ID2('C', 'F'), /* CacheFile */
+ ID_WS = MAKE_ID2('W', 'S'), /* WorkSpace */
+ ID_LP = MAKE_ID2('L', 'P'), /* LightProbe */
+ ID_HA = MAKE_ID2('H', 'A'), /* Hair */
+ ID_PT = MAKE_ID2('P', 'T'), /* PointCloud */
+ ID_VO = MAKE_ID2('V', 'O'), /* Volume */
+ ID_SIM = MAKE_ID2('S', 'I'), /* Simulation (geometry node groups) */
+} ID_Type;
+
+/* Only used as 'placeholder' in .blend files for directly linked data-blocks. */
+#define ID_LINK_PLACEHOLDER MAKE_ID2('I', 'D') /* (internal use only) */
+
+/* Deprecated. */
+#define ID_SCRN MAKE_ID2('S', 'N')
+
+/* NOTE! Fake IDs, needed for g.sipo->blocktype or outliner */
+#define ID_SEQ MAKE_ID2('S', 'Q')
+/* constraint */
+#define ID_CO MAKE_ID2('C', 'O')
+/* pose (action channel, used to be ID_AC in code, so we keep code for backwards compat) */
+#define ID_PO MAKE_ID2('A', 'C')
+/* used in outliner... */
+#define ID_NLA MAKE_ID2('N', 'L')
+/* fluidsim Ipo */
+#define ID_FLUIDSIM MAKE_ID2('F', 'S')
+
+#ifdef __cplusplus
+}
+#endif