[Bf-blender-cvs] [047c05ed687] hair_guides: Add new Groom ID type to use for groom objects.

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


Commit: 047c05ed687a4b53acbc92818ed7c89453f001ed
Author: Lukas Tönne
Date:   Sun Dec 10 09:42:45 2017 +0000
Branches: hair_guides
https://developer.blender.org/rB047c05ed687a4b53acbc92818ed7c89453f001ed

Add new Groom ID type to use for groom objects.

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

M	source/blender/CMakeLists.txt
A	source/blender/blenkernel/BKE_groom.h
M	source/blender/blenkernel/BKE_main.h
M	source/blender/blenkernel/CMakeLists.txt
A	source/blender/blenkernel/intern/groom.c
M	source/blender/blenkernel/intern/idcode.c
M	source/blender/blenkernel/intern/library.c
M	source/blender/blenkernel/intern/library_query.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/editors/object/object_relations.c
M	source/blender/makesdna/DNA_ID.h
A	source/blender/makesdna/DNA_groom_types.h
M	source/blender/makesdna/intern/makesdna.c

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

diff --git a/source/blender/CMakeLists.txt b/source/blender/CMakeLists.txt
index c2fac8fc7d7..a185d10a6bb 100644
--- a/source/blender/CMakeLists.txt
+++ b/source/blender/CMakeLists.txt
@@ -48,7 +48,9 @@ set(SRC_DNA_INC
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_genfile.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpencil_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_gpu_types.h
+	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_groom_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_group_types.h
+	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_hair_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_image_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_ipo_types.h
 	${CMAKE_CURRENT_SOURCE_DIR}/makesdna/DNA_key_types.h
diff --git a/source/blender/blenkernel/BKE_groom.h b/source/blender/blenkernel/BKE_groom.h
new file mode 100644
index 00000000000..a32091208cd
--- /dev/null
+++ b/source/blender/blenkernel/BKE_groom.h
@@ -0,0 +1,45 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is Copyright (C) Blender Foundation
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Lukas Toenne
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef __BKE_GROOM_H__
+#define __BKE_GROOM_H__
+
+/** \file BKE_groom.h
+ *  \ingroup bke
+ */
+
+struct Groom;
+struct Main;
+
+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);
+struct Groom *BKE_groom_copy(struct Main *bmain, const struct Groom *groom);
+
+void BKE_groom_make_local(struct Main *bmain, struct Groom *groom, const bool lib_local);
+
+#endif /*  __BKE_GROOM_H__ */
diff --git a/source/blender/blenkernel/BKE_main.h b/source/blender/blenkernel/BKE_main.h
index faa91fd4f79..34576cb3fc5 100644
--- a/source/blender/blenkernel/BKE_main.h
+++ b/source/blender/blenkernel/BKE_main.h
@@ -125,6 +125,7 @@ typedef struct Main {
 	ListBase linestyle;
 	ListBase cachefiles;
 	ListBase workspaces;
+	ListBase grooms;
 
 	char id_tag_update[MAX_LIBARRAY];
 
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 98a3dce5532..8536c7eb640 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -112,6 +112,7 @@ set(SRC
 	intern/font.c
 	intern/freestyle.c
 	intern/gpencil.c
+	intern/groom.c
 	intern/group.c
 	intern/hair.c
 	intern/hair_draw.c
@@ -248,6 +249,7 @@ set(SRC
 	BKE_freestyle.h
 	BKE_global.h
 	BKE_gpencil.h
+	BKE_groom.h
 	BKE_group.h
 	BKE_hair.h
 	BKE_icons.h
diff --git a/source/blender/blenkernel/intern/groom.c b/source/blender/blenkernel/intern/groom.c
new file mode 100644
index 00000000000..31aa4de2848
--- /dev/null
+++ b/source/blender/blenkernel/intern/groom.c
@@ -0,0 +1,84 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * 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.
+ *
+ * The Original Code is Copyright (C) Blender Foundation
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): Lukas Toenne
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/blenkernel/intern/gpencil.c
+ *  \ingroup bke
+ */
+
+ 
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_blenlib.h"
+#include "BLI_utildefines.h"
+#include "BLI_string_utils.h"
+
+#include "BLT_translation.h"
+
+#include "DNA_groom_types.h"
+#include "DNA_scene_types.h"
+
+#include "BKE_animsys.h"
+#include "BKE_global.h"
+#include "BKE_groom.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+
+
+/** Free (or release) any data used by this groom (does not free the groom itself). */
+void BKE_groom_free(Groom *groom)
+{
+	BKE_animdata_free(&groom->id, false);
+}
+
+/**
+ * Only copy internal data of Groom ID from source to already allocated/initialized destination.
+ * You probably never want to use that directly, use id_copy or BKE_id_copy_ex for typical needs.
+ *
+ * WARNING! This function will not handle ID user count!
+ *
+ * \param flag  Copying options (see BKE_library.h's LIB_ID_COPY_... flags for more).
+ */
+void BKE_groom_copy_data(Main *UNUSED(bmain), Groom *groom_dst, const Groom *groom_src, const int UNUSED(flag))
+{
+	UNUSED_VARS(groom_dst, groom_src);
+}
+
+Groom *BKE_groom_copy(Main *bmain, const Groom *groom)
+{
+	Groom *groom_copy;
+	BKE_id_copy_ex(bmain, &groom->id, (ID **)&groom_copy, 0, false);
+	return groom_copy;
+}
+
+void BKE_groom_make_local(Main *bmain, Groom *groom, const bool lib_local)
+{
+	BKE_id_make_local_generic(bmain, &groom->id, true, lib_local);
+}
diff --git a/source/blender/blenkernel/intern/idcode.c b/source/blender/blenkernel/intern/idcode.c
index 487635f06ad..bc1818db3e0 100644
--- a/source/blender/blenkernel/intern/idcode.c
+++ b/source/blender/blenkernel/intern/idcode.c
@@ -281,6 +281,7 @@ int BKE_idcode_to_index(const short idcode)
 		CASE_IDINDEX(CF);
 		CASE_IDINDEX(CU);
 		CASE_IDINDEX(GD);
+		CASE_IDINDEX(GM);
 		CASE_IDINDEX(GR);
 		CASE_IDINDEX(IM);
 		CASE_IDINDEX(KE);
diff --git a/source/blender/blenkernel/intern/library.c b/source/blender/blenkernel/intern/library.c
index 99dd6f86549..57dc067b8e2 100644
--- a/source/blender/blenkernel/intern/library.c
+++ b/source/blender/blenkernel/intern/library.c
@@ -47,8 +47,9 @@
 #include "DNA_brush_types.h"
 #include "DNA_cachefile_types.h"
 #include "DNA_camera_types.h"
-#include "DNA_group_types.h"
 #include "DNA_gpencil_types.h"
+#include "DNA_groom_types.h"
+#include "DNA_group_types.h"
 #include "DNA_ipo_types.h"
 #include "DNA_key_types.h"
 #include "DNA_lamp_types.h"
@@ -97,6 +98,7 @@
 #include "BKE_global.h"
 #include "BKE_group.h"
 #include "BKE_gpencil.h"
+#include "BKE_groom.h"
 #include "BKE_idcode.h"
 #include "BKE_idprop.h"
 #include "BKE_image.h"
@@ -474,6 +476,9 @@ bool id_make_local(Main *bmain, ID *id, const bool test, const bool lib_local)
 		case ID_CF:
 			if (!test) BKE_cachefile_make_local(bmain, (CacheFile *)id, lib_local);
 			return true;
+		case ID_GM:
+			if (!test) BKE_groom_make_local(bmain, (Groom *)id, lib_local);
+			return true;
 		case ID_WS:
 		case ID_SCR:
 			/* A bit special: can be appended but not linked. Return false
@@ -658,6 +663,9 @@ bool BKE_id_copy_ex(Main *bmain, const ID *id, ID **r_newid, const int flag, con
 		case ID_VF:
 			BKE_vfont_copy_data(bmain, (VFont *)*r_newid, (VFont *)id, flag);
 			break;
+		case ID_GM:
+			BKE_groom_copy_data(bmain, (Groom *)*r_newid, (Groom *)id, flag);
+			break;
 		case ID_LI:
 		case ID_SCR:
 		case ID_WM:
@@ -888,6 +896,8 @@ ListBase *which_libbase(Main *mainlib, short type)
 			return &(mainlib->cachefiles);
 		case ID_WS:
 			return &(mainlib->workspaces);
+		case ID_GM:
+			return &(mainlib->grooms);
 	}
 	return NULL;
 }
@@ -1013,6 +1023,7 @@ int set_listbasepointers(Main *main, ListBase **lb)
 	lb[INDEX_ID_ME] = &(main->mesh);
 	lb[INDEX_ID_CU] = &(main->curve);
 	lb[INDEX_ID_MB] = &(main->mball);
+	lb[INDEX_ID_GM] = &(main->grooms);
 
 	lb[INDEX_ID_LT] = &(main->latt);
 	lb[INDEX_ID_LA] = &(main->lamp);
@@ -1104,6 +1115,7 @@ size_t BKE_libblock_get_alloc_info(short type, const char **name)
 		CASE_RETURN(ID_PC,  PaintCurve);
 		CASE_RETURN(ID_CF,  CacheFile);
 		CASE_RETURN(ID_WS,  WorkSpace);
+		CASE_RETURN(ID_GM,  Groom);
 	}
 	return 0;
 #undef CASE_RETURN
diff --git a/source/blender/blenkernel/intern/library_query.c b/source/blender/blenkernel/intern/library_query.c
index 93bc4be7954..04463c9a8e4 100644
--- a/source/blender/blenkernel/intern/library_query.c
+++ b/source/blender/blenkernel/intern/library_query.c
@@ -38,6 +38,7 @@
 #include "DNA_camera_types.h"
 #include "DNA_constraint_types.h"
 #include "DNA_controller_types.h"
+#include "DNA_groom_types.h"
 #include "DNA_group_types.h"
 #include "DNA_gpencil_types.h"
 #include "DNA_key_types.h"
@@ -662,6 +663,13 @@ void BKE_library_foreach_ID_link(Main *bmain, ID *id, LibraryIDLinkCallback call
 				break;
 			}
 
+			case ID_GM:
+			{
+				Groom *groom = (Groom *) id;
+				UNUSED_VARS(groom);
+				break;
+			}
+
 			case ID_MA:
 			{
 				Material *material = (Material *) id;
@@ -1130,6 +1138,8 @@ bool BKE_library_id_can_use_idtype(ID *id_owner, const short id_type_used)
 			return (ELEM(id_type_used, ID_TE, ID_OB));
 		case ID_LP:
 			return ELEM(id_type_used, ID_IM);
+		case ID_GM:
+			return true;
 		case ID_WS:
 		case ID_IM:
 		case ID_VF:
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 4bcdf5f0359..0c033b1874a 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -71,6 +71,7 @@
 #include "DNA_effect_types.h"
 #include "DNA_fileglobal_types.h"
 #include "DNA_genfile.h"
+#include "DNA_groom_types.h"
 #include "DNA_group_types.h"

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list