[Bf-blender-cvs] [12200ce0b19] hair_guides: Add groom object id in a few more functions that need it.

Lukas Tönne noreply at git.blender.org
Sun Dec 10 12:48:30 CET 2017


Commit: 12200ce0b19ef73225f097879d6bd6a7ea87988e
Author: Lukas Tönne
Date:   Sun Dec 10 11:48:07 2017 +0000
Branches: hair_guides
https://developer.blender.org/rB12200ce0b19ef73225f097879d6bd6a7ea87988e

Add groom object id in a few more functions that need it.

===================================================================

M	source/blender/blenkernel/BKE_groom.h
M	source/blender/blenkernel/intern/groom.c
M	source/blender/blenkernel/intern/library.c
M	source/blender/blenkernel/intern/object.c
M	source/blender/makesdna/DNA_object_types.h
M	source/blender/makesrna/intern/rna_main_api.c
M	source/blender/makesrna/intern/rna_object.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_groom.h b/source/blender/blenkernel/BKE_groom.h
index a32091208cd..e5088b4d8e3 100644
--- a/source/blender/blenkernel/BKE_groom.h
+++ b/source/blender/blenkernel/BKE_groom.h
@@ -35,6 +35,9 @@
 struct Groom;
 struct Main;
 
+void BKE_groom_init(struct Groom *groom);
+void *BKE_groom_add(struct Main *bmain, const char *name);
+
 void BKE_groom_free(struct Groom *groom);
 
 void BKE_groom_copy_data(struct Main *bmain, struct Groom *groom_dst, const struct Groom *groom_src, const int flag);
diff --git a/source/blender/blenkernel/intern/groom.c b/source/blender/blenkernel/intern/groom.c
index 31aa4de2848..cd0a38dcbb7 100644
--- a/source/blender/blenkernel/intern/groom.c
+++ b/source/blender/blenkernel/intern/groom.c
@@ -52,6 +52,20 @@
 #include "BKE_main.h"
 
 
+void BKE_groom_init(Groom *groom)
+{
+	BLI_assert(MEMCMP_STRUCT_OFS_IS_ZERO(groom, id));
+}
+
+void *BKE_groom_add(Main *bmain, const char *name)
+{
+	Groom *groom = BKE_libblock_alloc(bmain, ID_GM, name, 0);
+
+	BKE_groom_init(groom);
+
+	return groom;
+}
+
 /** Free (or release) any data used by this groom (does not free the groom itself). */
 void BKE_groom_free(Groom *groom)
 {
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 38407af95b0..0bc4202da5b 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -752,6 +752,7 @@ void BKE_id_swap(Main *bmain, ID *id_a, ID *id_b)
 		CASE_SWAP(ID_PAL, Palette);
 		CASE_SWAP(ID_PC, PaintCurve);
 		CASE_SWAP(ID_CF, CacheFile);
+		CASE_SWAP(ID_GM, Groom);
 		case ID_IP:
 			break;  /* Deprecated. */
 	}
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index c819ab03746..c2740be2056 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -74,6 +74,7 @@
 #include "BKE_pbvh.h"
 #include "BKE_main.h"
 #include "BKE_global.h"
+#include "BKE_groom.h"
 #include "BKE_idprop.h"
 #include "BKE_armature.h"
 #include "BKE_action.h"
@@ -614,6 +615,7 @@ void *BKE_object_obdata_add_from_type(Main *bmain, int type, const char *name)
 		case OB_ARMATURE:  return BKE_armature_add(bmain, name);
 		case OB_SPEAKER:   return BKE_speaker_add(bmain, name);
 		case OB_LIGHTPROBE:return BKE_lightprobe_add(bmain, name);
+		case OB_GROOM:     return BKE_groom_add(bmain, name);
 		case OB_EMPTY:     return NULL;
 		default:
 			printf("%s: Internal error, bad type: %d\n", __func__, type);
diff --git a/source/blender/makesdna/DNA_object_types.h b/source/blender/makesdna/DNA_object_types.h
index 62de044aaf0..5cc698c66ba 100644
--- a/source/blender/makesdna/DNA_object_types.h
+++ b/source/blender/makesdna/DNA_object_types.h
@@ -408,16 +408,16 @@ enum {
 #define OB_TYPE_SUPPORT_VGROUP(_type) \
 	(ELEM(_type, OB_MESH, OB_LATTICE))
 #define OB_TYPE_SUPPORT_EDITMODE(_type) \
-	(ELEM(_type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE))
+	(ELEM(_type, OB_MESH, OB_FONT, OB_CURVE, OB_SURF, OB_MBALL, OB_LATTICE, OB_ARMATURE, OB_GROOM))
 #define OB_TYPE_SUPPORT_PARVERT(_type) \
 	(ELEM(_type, OB_MESH, OB_SURF, OB_CURVE, OB_LATTICE))
 
 /* is this ID type used as object data */
 #define OB_DATA_SUPPORT_ID(_id_type) \
-	(ELEM(_id_type, ID_ME, ID_CU, ID_MB, ID_LA, ID_SPK, ID_LP, ID_CA, ID_LT, ID_AR))
+	(ELEM(_id_type, ID_ME, ID_CU, ID_MB, ID_LA, ID_SPK, ID_LP, ID_CA, ID_LT, ID_AR, ID_GM))
 
 #define OB_DATA_SUPPORT_ID_CASE \
-	ID_ME: case ID_CU: case ID_MB: case ID_LA: case ID_SPK: case ID_LP: case ID_CA: case ID_LT: case ID_AR
+	ID_ME: case ID_CU: case ID_MB: case ID_LA: case ID_SPK: case ID_LP: case ID_CA: case ID_LT: case ID_AR: case ID_GM
 
 /* partype: first 4 bits: type */
 enum {
diff --git a/source/blender/makesrna/intern/rna_main_api.c b/source/blender/makesrna/intern/rna_main_api.c
index f15006fa0ed..c6b1811187c 100644
--- a/source/blender/makesrna/intern/rna_main_api.c
+++ b/source/blender/makesrna/intern/rna_main_api.c
@@ -234,6 +234,9 @@ static Object *rna_Main_objects_new(Main *bmain, ReportList *reports, const char
 			case ID_AR:
 				type = OB_ARMATURE;
 				break;
+			case ID_GM:
+				type = OB_GROOM;
+				break;
 			default:
 			{
 				const char *idname;
diff --git a/source/blender/makesrna/intern/rna_object.c b/source/blender/makesrna/intern/rna_object.c
index a153590f4ac..e1d922d7f64 100644
--- a/source/blender/makesrna/intern/rna_object.c
+++ b/source/blender/makesrna/intern/rna_object.c
@@ -160,6 +160,7 @@ const EnumPropertyItem rna_enum_object_type_items[] = {
 	{OB_LAMP, "LAMP", 0, "Lamp", ""},
 	{OB_SPEAKER, "SPEAKER", 0, "Speaker", ""},
 	{OB_LIGHTPROBE, "LIGHT_PROBE", 0, "Probe", ""},
+	{OB_GROOM, "GROOM", 0, "Groom", ""},
 	{0, NULL, 0, NULL, NULL}
 };
 
@@ -376,6 +377,7 @@ static StructRNA *rna_Object_data_typef(PointerRNA *ptr)
 		case OB_ARMATURE: return &RNA_Armature;
 		case OB_SPEAKER: return &RNA_Speaker;
 		case OB_LIGHTPROBE: return &RNA_LightProbe;
+		case OB_GROOM: return &RNA_Groom;
 		default: return &RNA_ID;
 	}
 }



More information about the Bf-blender-cvs mailing list