1 #pragma once
2 
3 #include "BlenderDNA.h"
4 #include "BlenderScene.h"
5 #include <memory>
6 
7 namespace Assimp {
8     namespace Blender {
9         /* CustomData.type from Blender (2.79b) */
10         enum CustomDataType {
11             CD_AUTO_FROM_NAME = -1,
12             CD_MVERT = 0,
13 #ifdef DNA_DEPRECATED
14             CD_MSTICKY = 1,  /* DEPRECATED */
15 #endif
16             CD_MDEFORMVERT = 2,
17             CD_MEDGE = 3,
18             CD_MFACE = 4,
19             CD_MTFACE = 5,
20             CD_MCOL = 6,
21             CD_ORIGINDEX = 7,
22             CD_NORMAL = 8,
23             /*	CD_POLYINDEX        = 9, */
24             CD_PROP_FLT = 10,
25             CD_PROP_INT = 11,
26             CD_PROP_STR = 12,
27             CD_ORIGSPACE = 13,  /* for modifier stack face location mapping */
28             CD_ORCO = 14,
29             CD_MTEXPOLY = 15,
30             CD_MLOOPUV = 16,
31             CD_MLOOPCOL = 17,
32             CD_TANGENT = 18,
33             CD_MDISPS = 19,
34             CD_PREVIEW_MCOL = 20,  /* for displaying weightpaint colors */
35             /*	CD_ID_MCOL          = 21, */
36             CD_TEXTURE_MLOOPCOL = 22,
37             CD_CLOTH_ORCO = 23,
38             CD_RECAST = 24,
39 
40             /* BMESH ONLY START */
41             CD_MPOLY = 25,
42             CD_MLOOP = 26,
43             CD_SHAPE_KEYINDEX = 27,
44             CD_SHAPEKEY = 28,
45             CD_BWEIGHT = 29,
46             CD_CREASE = 30,
47             CD_ORIGSPACE_MLOOP = 31,
48             CD_PREVIEW_MLOOPCOL = 32,
49             CD_BM_ELEM_PYPTR = 33,
50             /* BMESH ONLY END */
51 
52             CD_PAINT_MASK = 34,
53             CD_GRID_PAINT_MASK = 35,
54             CD_MVERT_SKIN = 36,
55             CD_FREESTYLE_EDGE = 37,
56             CD_FREESTYLE_FACE = 38,
57             CD_MLOOPTANGENT = 39,
58             CD_TESSLOOPNORMAL = 40,
59             CD_CUSTOMLOOPNORMAL = 41,
60 
61             CD_NUMTYPES = 42
62         };
63 
64         /**
65         *   @brief  check if given cdtype is valid (ie >= 0 and < CD_NUMTYPES)
66         *   @param[in]  cdtype to check
67         *   @return true when valid
68         */
69         bool isValidCustomDataType(const int cdtype);
70 
71         /**
72         *   @brief  returns CustomDataLayer ptr for given cdtype and name
73         *   @param[in]  customdata CustomData to search for wanted layer
74         *   @param[in]  cdtype to search for
75         *   @param[in]  name to search for
76         *   @return CustomDataLayer * or nullptr if not found
77         */
78         std::shared_ptr<CustomDataLayer> getCustomDataLayer(const CustomData &customdata, CustomDataType cdtype, const std::string &name);
79 
80         /**
81         *   @brief  returns CustomDataLayer data ptr for given cdtype and name
82         *   @param[in]  customdata CustomData to search for wanted layer
83         *   @param[in]  cdtype to search for
84         *   @param[in]  name to search for
85         *   @return * to struct data or nullptr if not found
86         */
87         const ElemBase * getCustomDataLayerData(const CustomData &customdata, CustomDataType cdtype, const std::string &name);
88     }
89 }
90