BlenderCustomData.h 2.9 KB

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