Commit: fb9824e755cef424a9a4643e625252f3d529dd0e
Author: Lukas Tönne
Date:   Tue Oct 7 19:51:54 2014 +0200
Branches: hair_immediate_fixes
https://developer.blender.org/rBfb9824e755cef424a9a4643e625252f3d529dd0e

New editor library for hair edit mode.

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

M       build_files/cmake/macros.cmake
M       source/blender/editors/CMakeLists.txt
M       source/blender/editors/SConscript
A       source/blender/editors/hair/CMakeLists.txt
A       source/blender/editors/hair/SConscript
A       source/blender/editors/hair/hair_edit.c
A       source/blender/editors/hair/hair_intern.h
A       source/blender/editors/hair/hair_ops.c

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

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 86732a9..836d90c 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -481,6 +481,7 @@ macro(SETUP_BLENDER_SORTED_LIBS)
                bf_editor_object
                bf_editor_armature
                bf_editor_physics
+               bf_editor_hair
                bf_editor_render
                bf_editor_screen
                bf_editor_sculpt_paint
diff --git a/source/blender/editors/CMakeLists.txt 
b/source/blender/editors/CMakeLists.txt
index 084006c..ec9ae77 100644
--- a/source/blender/editors/CMakeLists.txt
+++ b/source/blender/editors/CMakeLists.txt
@@ -23,6 +23,7 @@ if(WITH_BLENDER)
        add_subdirectory(armature)
        add_subdirectory(curve)
        add_subdirectory(gpencil)
+       add_subdirectory(hair)
        add_subdirectory(interface)
        add_subdirectory(io)
        add_subdirectory(mask)
diff --git a/source/blender/editors/SConscript 
b/source/blender/editors/SConscript
index 1ea2bc0..0ef0473 100644
--- a/source/blender/editors/SConscript
+++ b/source/blender/editors/SConscript
@@ -41,6 +41,7 @@ SConscript(['datafiles/SConscript',
             'object/SConscript',
             'curve/SConscript',
             'gpencil/SConscript',
+            'hair/SConscript',
             'physics/SConscript',
             'render/SConscript',
             'sound/SConscript',
diff --git a/source/blender/editors/hair/CMakeLists.txt 
b/source/blender/editors/hair/CMakeLists.txt
new file mode 100644
index 0000000..22a9d57
--- /dev/null
+++ b/source/blender/editors/hair/CMakeLists.txt
@@ -0,0 +1,42 @@
+# ***** 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): Jacques Beaurain.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+set(INC
+       ../include
+       ../../blenfont
+       ../../blenkernel
+       ../../blenlib
+       ../../makesdna
+       ../../makesrna
+       ../../windowmanager
+       ../../../../intern/guardedalloc
+)
+
+set(INC_SYS
+)
+
+set(SRC
+       hair_edit.c
+       hair_ops.c
+
+       hair_intern.h
+)
+
+blender_add_lib(bf_editor_hair "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/source/blender/editors/hair/SConscript 
b/source/blender/editors/hair/SConscript
new file mode 100644
index 0000000..e947d8c
--- /dev/null
+++ b/source/blender/editors/hair/SConscript
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+#
+# ***** 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) 2006, Blender Foundation
+# All rights reserved.
+#
+# The Original Code is: all of this file.
+#
+# Contributor(s): Nathan Letwory.
+#
+# ***** END GPL LICENSE BLOCK *****
+
+Import ('env')
+
+sources = env.Glob('*.c')
+
+incs = [
+    '#/intern/guardedalloc',
+    '../include',
+    '../../blenfont',
+    '../../blenkernel',
+    '../../blenlib',
+    '../../makesdna',
+    '../../makesrna',
+    '../../windowmanager',
+    ]
+incs = ' '.join(incs)
+
+defs = []
+
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 
'win64-mingw'):
+    incs += ' ' + env['BF_PTHREADS_INC']
+
+env.BlenderLib ( 'bf_editors_hair', sources, Split(incs), defs, 
libtype=['core'], priority=[45] )
diff --git a/source/blender/editors/hair/hair_edit.c 
b/source/blender/editors/hair/hair_edit.c
new file mode 100644
index 0000000..fb8f090
--- /dev/null
+++ b/source/blender/editors/hair/hair_edit.c
@@ -0,0 +1,75 @@
+/*
+ * ***** 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/hair/hair_edit.c
+ *  \ingroup edhair
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "hair_intern.h"
+
+HairEditData *hair_edit_create(int totcurves, int totverts)
+{
+       HairEditData *hedit = MEM_callocN(sizeof(HairEditData), "hair edit 
data");
+       
+       hedit->curves = MEM_callocN(sizeof(HairEditCurve) * totcurves, "hair 
edit curves");
+       hedit->totcurves = totcurves;
+       
+       hedit->verts = MEM_callocN(sizeof(HairEditVertex) * totverts, "hair 
edit verts");
+       hedit->totverts = totverts;
+       
+       return hedit;
+}
+
+HairEditData *hair_edit_copy(HairEditData *hedit)
+{
+       HairEditData *thedit = MEM_dupallocN(hedit);
+       
+       if (hedit->curves) {
+               thedit->curves = MEM_dupallocN(hedit->curves);
+       }
+       
+       if (hedit->verts) {
+               thedit->verts = MEM_dupallocN(hedit->verts);
+       }
+       
+       return thedit;
+}
+
+void hair_edit_free(HairEditData *hedit)
+{
+       if (hedit->curves) {
+               MEM_freeN(hedit->curves);
+       }
+       
+       if (hedit->verts) {
+               MEM_freeN(hedit->verts);
+       }
+       
+       MEM_freeN(hedit);
+}
diff --git a/source/blender/editors/hair/hair_intern.h 
b/source/blender/editors/hair/hair_intern.h
new file mode 100644
index 0000000..bb3fa2a
--- /dev/null
+++ b/source/blender/editors/hair/hair_intern.h
@@ -0,0 +1,69 @@
+/*
+ * ***** 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/hair/hair_intern.h
+ *  \ingroup edhair
+ */
+
+#ifndef __HAIR_INTERN_H__
+#define __HAIR_INTERN_H__
+
+#include "DNA_customdata_types.h"
+
+struct Object;
+struct ParticleSystem;
+
+/* hair curve */
+typedef struct HairEditCurve {
+       int start;          /* first vertex index */
+} HairEditCurve;
+
+typedef struct HairEditVertex {
+       float co[3];
+} HairEditVertex;
+
+typedef struct HairEditData {
+       HairEditCurve *curves;
+       HairEditVertex *verts;
+       
+       int totcurves;
+       int totverts;
+       
+       CustomData hdata;   /* curve data */
+       CustomData vdata;   /* vertex data */
+} HairEditData;
+
+struct HairEditData *hair_edit_create(int totcurves, int totverts);
+struct HairEditData *hair_edit_copy(struct HairEditData *hedit);
+void hair_edit_free(struct HairEditData *hedit);
+
+/* === particle conversion === */
+
+struct HairEditData *hair_edit_from_particles(struct Object *ob, struct 
ParticleSystem *psys);
+void hair_edit_to_particles(struct HairEditData *hedit, struct Object *ob, 
struct ParticleSystem *psys);
+
+#endif
diff --git a/source/blender/editors/hair/hair_ops.c 
b/source/blender/editors/hair/hair_ops.c
new file mode 100644
index 0000000..d8f42d9
--- /dev/null
+++ b/source/blender/editors/hair/hair_ops.c
@@ -0,0 +1,30 @@
+/*
+ * ***** 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/hair/hair_ops.c
+ *  \ingroup edhair
+ */

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to