[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56955] trunk/blender/source/blender/ freestyle/intern: Added new method Stroke.remove_all_vertices() for removing all vertices from the stroke.

Tamito Kajiyama rd6t-kjym at asahi-net.or.jp
Wed May 22 00:59:44 CEST 2013


Revision: 56955
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56955
Author:   kjym3
Date:     2013-05-21 22:59:44 +0000 (Tue, 21 May 2013)
Log Message:
-----------
Added new method Stroke.remove_all_vertices() for removing all vertices from the stroke.
Patch from flokkievids in the BA Freestyle thread, thanks!

Modified Paths:
--------------
    trunk/blender/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
    trunk/blender/source/blender/freestyle/intern/stroke/Stroke.cpp
    trunk/blender/source/blender/freestyle/intern/stroke/Stroke.h

Modified: trunk/blender/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp	2013-05-21 20:21:46 UTC (rev 56954)
+++ trunk/blender/source/blender/freestyle/intern/python/Interface1D/BPy_Stroke.cpp	2013-05-21 22:59:44 UTC (rev 56955)
@@ -218,6 +218,17 @@
 	Py_RETURN_NONE;
 }
 
+PyDoc_STRVAR(Stroke_remove_all_vertices_doc,
+".. method:: remove_all_vertices()\n"
+"\n"
+"   Removes all vertices from the Stroke.");
+
+static PyObject *Stroke_remove_all_vertices(BPy_Stroke *self)
+{
+	self->s->RemoveAllVertices();
+	Py_RETURN_NONE;
+}
+
 PyDoc_STRVAR(Stroke_update_length_doc,
 ".. method:: update_length()\n"
 "\n"
@@ -285,6 +296,7 @@
 	{"compute_sampling", (PyCFunction)Stroke_compute_sampling, METH_VARARGS | METH_KEYWORDS,
 	                     Stroke_compute_sampling_doc},
 	{"resample", (PyCFunction)Stroke_resample, METH_VARARGS | METH_KEYWORDS, Stroke_resample_doc},
+	{"remove_all_vertices", (PyCFunction)Stroke_remove_all_vertices, METH_NOARGS, Stroke_remove_all_vertices_doc},
 	{"remove_vertex", (PyCFunction)Stroke_remove_vertex, METH_VARARGS | METH_KEYWORDS, Stroke_remove_vertex_doc},
 	{"insert_vertex", (PyCFunction)Stroke_insert_vertex, METH_VARARGS | METH_KEYWORDS, Stroke_insert_vertex_doc},
 	{"update_length", (PyCFunction)Stroke_update_length, METH_NOARGS, Stroke_update_length_doc},

Modified: trunk/blender/source/blender/freestyle/intern/stroke/Stroke.cpp
===================================================================
--- trunk/blender/source/blender/freestyle/intern/stroke/Stroke.cpp	2013-05-21 20:21:46 UTC (rev 56954)
+++ trunk/blender/source/blender/freestyle/intern/stroke/Stroke.cpp	2013-05-21 22:59:44 UTC (rev 56955)
@@ -644,6 +644,15 @@
 	}
 }
 
+void Stroke::RemoveAllVertices()
+{
+	vertex_container::iterator it = _Vertices.begin(), itend = _Vertices.end();
+	for (; it != itend; ++it)
+		delete (*it);
+	_Vertices.clear();
+	UpdateLength();
+}
+
 void Stroke::RemoveVertex(StrokeVertex *iVertex)
 {
 	vertex_container::iterator it = _Vertices.begin(), itend = _Vertices.end();

Modified: trunk/blender/source/blender/freestyle/intern/stroke/Stroke.h
===================================================================
--- trunk/blender/source/blender/freestyle/intern/stroke/Stroke.h	2013-05-21 20:21:46 UTC (rev 56954)
+++ trunk/blender/source/blender/freestyle/intern/stroke/Stroke.h	2013-05-21 22:59:44 UTC (rev 56955)
@@ -589,6 +589,10 @@
 	 */
 	void Resample(float iSampling);
 
+    /*! Removes all vertices from the Stroke.
+     */
+    void RemoveAllVertices();
+
 	/*! Removes the stroke vertex iVertex 
 	*  from the stroke.
 	*  The length and curvilinear abscissa are updated




More information about the Bf-blender-cvs mailing list