[Bf-blender-cvs] [61fae8440db] hair_guides: Edit mode data functions for creating, applying a freeing groom edit data.

Lukas Tönne noreply at git.blender.org
Tue Dec 19 15:49:44 CET 2017


Commit: 61fae8440dbca3fcbaea499309e325e9df46a7a9
Author: Lukas Tönne
Date:   Tue Dec 19 14:35:00 2017 +0000
Branches: hair_guides
https://developer.blender.org/rB61fae8440dbca3fcbaea499309e325e9df46a7a9

Edit mode data functions for creating, applying a freeing groom edit data.

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

M	build_files/cmake/macros.cmake
M	source/blender/blenkernel/intern/groom.c
M	source/blender/blenkernel/intern/object.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/editors/CMakeLists.txt
A	source/blender/editors/groom/CMakeLists.txt
A	source/blender/editors/groom/editgroom.c
A	source/blender/editors/groom/groom_intern.h
A	source/blender/editors/groom/groom_ops.c
A	source/blender/editors/include/ED_groom.h
M	source/blender/editors/include/ED_screen.h
M	source/blender/editors/object/object_edit.c
M	source/blender/editors/screen/screen_ops.c
M	source/blender/editors/space_api/spacetypes.c
M	source/blender/makesdna/DNA_groom_types.h
M	source/blender/windowmanager/WM_types.h

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

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 2e16b9238b3..f697c9281cf 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -599,6 +599,7 @@ function(SETUP_BLENDER_SORTED_LIBS)
 		bf_editor_datafiles
 		bf_editor_mask
 		bf_editor_io
+		bf_editor_groom
 
 		bf_render
 		bf_python
diff --git a/source/blender/blenkernel/intern/groom.c b/source/blender/blenkernel/intern/groom.c
index d4f0fd4f832..0e7fe7c6397 100644
--- a/source/blender/blenkernel/intern/groom.c
+++ b/source/blender/blenkernel/intern/groom.c
@@ -83,14 +83,14 @@ static void groom_bundles_free(ListBase *bundles)
 /** Free (or release) any data used by this groom (does not free the groom itself). */
 void BKE_groom_free(Groom *groom)
 {
-	if (groom->edit_groom)
+	if (groom->editgroom)
 	{
-		EditGroom *edit = groom->edit_groom;
+		EditGroom *edit = groom->editgroom;
 		
 		groom_bundles_free(&edit->bundles);
 		
 		MEM_freeN(edit);
-		groom->edit_groom = NULL;
+		groom->editgroom = NULL;
 	}
 	
 	MEM_SAFE_FREE(groom->bb);
@@ -114,7 +114,7 @@ void BKE_groom_copy_data(Main *UNUSED(bmain), Groom *groom_dst, const Groom *gro
 	
 	BLI_duplicatelist(&groom_dst->bundles, &groom_src->bundles);
 	
-	groom_dst->edit_groom = NULL;
+	groom_dst->editgroom = NULL;
 }
 
 Groom *BKE_groom_copy(Main *bmain, const Groom *groom)
diff --git a/source/blender/blenkernel/intern/object.c b/source/blender/blenkernel/intern/object.c
index a8d2a7e3e7d..ab09ccf5654 100644
--- a/source/blender/blenkernel/intern/object.c
+++ b/source/blender/blenkernel/intern/object.c
@@ -540,7 +540,7 @@ bool BKE_object_is_in_editmode(Object *ob)
 	}
 	else if (ob->type == OB_GROOM) {
 		Groom *groom = ob->data;
-		if (groom->edit_groom)
+		if (groom->editgroom)
 			return true;
 	}
 	return false;
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 0f1a8e989ef..2a3920eb936 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -8403,7 +8403,7 @@ static void direct_link_groom(FileData *fd, Groom *groom)
 	
 	groom->bb = NULL;
 	
-	groom->edit_groom = NULL;
+	groom->editgroom = NULL;
 }
 
 /* ************** GENERAL & MAIN ******************** */
diff --git a/source/blender/editors/CMakeLists.txt b/source/blender/editors/CMakeLists.txt
index 757fca0a1b2..00b514d1a15 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -27,6 +27,7 @@ if(WITH_BLENDER)
 	add_subdirectory(armature)
 	add_subdirectory(curve)
 	add_subdirectory(gpencil)
+	add_subdirectory(groom)
 	add_subdirectory(interface)
 	add_subdirectory(io)
 	add_subdirectory(manipulator_library)
diff --git a/source/blender/editors/groom/CMakeLists.txt b/source/blender/editors/groom/CMakeLists.txt
new file mode 100644
index 00000000000..695b3846aaa
--- /dev/null
+++ b/source/blender/editors/groom/CMakeLists.txt
@@ -0,0 +1,47 @@
+# ***** 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.
+#
+# Contributor(s): Lukas Toenne.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+set(INC
+	../include
+	../../blenkernel
+	../../blenlib
+	../../blentranslation
+	../../depsgraph
+	../../makesdna
+	../../makesrna
+	../../windowmanager
+	../../../../intern/guardedalloc
+)
+
+set(INC_SYS
+)
+
+set(SRC
+	groom_ops.c
+	editgroom.c
+
+	groom_intern.h
+)
+
+if(WITH_INTERNATIONAL)
+	add_definitions(-DWITH_INTERNATIONAL)
+endif()
+
+blender_add_lib(bf_editor_groom "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/groom/editgroom.c b/source/blender/editors/groom/editgroom.c
new file mode 100644
index 00000000000..cfb129b6f64
--- /dev/null
+++ b/source/blender/editors/groom/editgroom.c
@@ -0,0 +1,117 @@
+/*
+ * ***** 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/editors/groom/editgroom.c
+ *  \ingroup edgroom
+ */
+
+#include "DNA_groom_types.h"
+#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_array_utils.h"
+#include "BLI_blenlib.h"
+
+#include "BKE_context.h"
+#include "BKE_global.h"
+#include "BKE_groom.h"
+#include "BKE_library.h"
+#include "BKE_main.h"
+#include "BKE_report.h"
+
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_build.h"
+
+#include "WM_api.h"
+#include "WM_types.h"
+
+#include "ED_groom.h"
+#include "ED_object.h"
+#include "ED_screen.h"
+#include "ED_types.h"
+#include "ED_util.h"
+
+#include "groom_intern.h"
+
+#include "UI_interface.h"
+#include "UI_resources.h"
+
+#include "RNA_access.h"
+#include "RNA_define.h"
+#include "RNA_enum_types.h"
+
+/********************** Load/Make/Free ********************/
+
+static void groom_bundles_free(ListBase *bundles)
+{
+	for (GroomBundle *bundle = bundles->first; bundle; bundle = bundle->next)
+	{
+		BLI_freelistN(&bundle->sections);
+	}
+	BLI_freelistN(bundles);
+}
+
+static void groom_bundles_copy(ListBase *bundles_dst, ListBase *bundles_src)
+{
+	BLI_duplicatelist(bundles_dst, bundles_src);
+	for (GroomBundle *bundle = bundles_dst->first; bundle; bundle = bundle->next)
+	{
+		BLI_duplicatelist(&bundle->sections, &bundle->sections);
+	}
+}
+
+void ED_groom_editgroom_make(Object *obedit)
+{
+	Groom *groom = obedit->data;
+
+	ED_groom_editgroom_free(obedit);
+
+	groom->editgroom = MEM_callocN(sizeof(EditGroom), "editgroom");
+	groom_bundles_copy(&groom->editgroom->bundles, &groom->bundles);
+}
+
+void ED_groom_editgroom_load(Object *obedit)
+{
+	Groom *groom = obedit->data;
+	
+	groom_bundles_free(&groom->bundles);
+	groom_bundles_copy(&groom->bundles, &groom->editgroom->bundles);
+}
+
+void ED_groom_editgroom_free(Object *ob)
+{
+	Groom *groom = ob->data;
+	
+	if (groom->editgroom) {
+		groom_bundles_free(&groom->editgroom->bundles);
+		
+		MEM_freeN(groom->editgroom);
+		groom->editgroom = NULL;
+	}
+}
diff --git a/source/blender/editors/groom/groom_intern.h b/source/blender/editors/groom/groom_intern.h
new file mode 100644
index 00000000000..336b82fb73e
--- /dev/null
+++ b/source/blender/editors/groom/groom_intern.h
@@ -0,0 +1,37 @@
+/*
+ * ***** 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/editors/groom/groom_intern.h
+ *  \ingroup edgroom
+ */
+
+
+#ifndef __GROOM_INTERN_H__
+#define __GROOM_INTERN_H__
+
+
+#endif /* __GROOM_INTERN_H__ */
diff --git a/source/blender/editors/groom/groom_ops.c b/source/blender/editors/groom/groom_ops.c
new file mode 100644
index 00000000000..73a4f40c0ce
--- /dev/null
+++ b/source/blender/editors/groom/groom_ops.c
@@ -0,0 +1,76 @@
+/*
+ * ***** 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/editors/groom/groom_ops.c
+ *  \ingroup edgroom
+ */
+
+
+#include <stdlib.h>
+#include <math.h>
+
+#include "DNA_

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list