Merge branch 'master' into blender2.8
authorSergey Sharybin <sergey.vfx@gmail.com>
Tue, 13 Jun 2017 15:45:36 +0000 (17:45 +0200)
committerSergey Sharybin <sergey.vfx@gmail.com>
Tue, 13 Jun 2017 15:45:36 +0000 (17:45 +0200)
1  2 
source/blender/blenkernel/BKE_library.h
source/blender/blenkernel/intern/library.c

index 04cd557e68a75f88f83af47977be54685def6301,75e606bc020e73087a259022f4b615e528f784a7..88173ccb98ca7e28d93e4f7b6057fdff7ad20522
@@@ -876,6 -857,60 +876,62 @@@ int set_listbasepointers(Main *main, Li
   *
   * **************************** */
  
+ /**
+  * Get allocation size fo a given datablock type and optionally allocation name.
+  */
+ size_t BKE_libblock_get_alloc_info(short type, const char **name)
+ {
+ #define CASE_RETURN(id_code, type)  \
+       case id_code:                   \
+               do {                        \
+                       if (name != NULL) {     \
+                               *name = #type;      \
+                       }                       \
+                       return sizeof(type);    \
+               } while(0)
+       switch ((ID_Type)type) {
+               CASE_RETURN(ID_SCE, Scene);
+               CASE_RETURN(ID_LI,  Library);
+               CASE_RETURN(ID_OB,  Object);
+               CASE_RETURN(ID_ME,  Mesh);
+               CASE_RETURN(ID_CU,  Curve);
+               CASE_RETURN(ID_MB,  MetaBall);
+               CASE_RETURN(ID_MA,  Material);
+               CASE_RETURN(ID_TE,  Tex);
+               CASE_RETURN(ID_IM,  Image);
+               CASE_RETURN(ID_LT,  Lattice);
+               CASE_RETURN(ID_LA,  Lamp);
+               CASE_RETURN(ID_CA,  Camera);
+               CASE_RETURN(ID_IP,  Ipo);
+               CASE_RETURN(ID_KE,  Key);
+               CASE_RETURN(ID_WO,  World);
+               CASE_RETURN(ID_SCR, bScreen);
+               CASE_RETURN(ID_VF,  VFont);
+               CASE_RETURN(ID_TXT, Text);
+               CASE_RETURN(ID_SPK, Speaker);
++              CASE_RETURN(ID_LP,  LightProbe);
+               CASE_RETURN(ID_SO,  bSound);
+               CASE_RETURN(ID_GR,  Group);
+               CASE_RETURN(ID_AR,  bArmature);
+               CASE_RETURN(ID_AC,  bAction);
+               CASE_RETURN(ID_NT,  bNodeTree);
+               CASE_RETURN(ID_BR,  Brush);
+               CASE_RETURN(ID_PA,  ParticleSettings);
+               CASE_RETURN(ID_WM,  wmWindowManager);
+               CASE_RETURN(ID_GD,  bGPdata);
+               CASE_RETURN(ID_MC,  MovieClip);
+               CASE_RETURN(ID_MSK, Mask);
+               CASE_RETURN(ID_LS,  FreestyleLineStyle);
+               CASE_RETURN(ID_PAL, Palette);
+               CASE_RETURN(ID_PC,  PaintCurve);
+               CASE_RETURN(ID_CF,  CacheFile);
++              CASE_RETURN(ID_WS,  WorkSpace);
+       }
+       return 0;
+ #undef CASE_RETURN
+ }
  /**
   * Allocates and returns memory of the right size for the specified block type,
   * initialized to zero.