Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/freestyle/intern/python/BPy_SShape.cpp')
-rw-r--r--source/blender/freestyle/intern/python/BPy_SShape.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/freestyle/intern/python/BPy_SShape.cpp b/source/blender/freestyle/intern/python/BPy_SShape.cpp
index e5a38171ecd..9169adf4d9f 100644
--- a/source/blender/freestyle/intern/python/BPy_SShape.cpp
+++ b/source/blender/freestyle/intern/python/BPy_SShape.cpp
@@ -185,7 +185,7 @@ PyDoc_STRVAR(SShape_name_doc,
static PyObject *SShape_name_get(BPy_SShape *self, void *UNUSED(closure))
{
- return PyUnicode_FromString(self->ss->getName().c_str());
+ return PyUnicode_FromString(self->ss->getName());
}
static int SShape_name_set(BPy_SShape *self, PyObject *value, void *UNUSED(closure))
@@ -194,7 +194,7 @@ static int SShape_name_set(BPy_SShape *self, PyObject *value, void *UNUSED(closu
PyErr_SetString(PyExc_TypeError, "value must be a string");
return -1;
}
- const string name = _PyUnicode_AsString(value);
+ const char *name = _PyUnicode_AsString(value);
self->ss->setName(name);
return 0;
}
@@ -227,13 +227,14 @@ PyDoc_STRVAR(SShape_vertices_doc,
static PyObject *SShape_vertices_get(BPy_SShape *self, void *UNUSED(closure))
{
- PyObject *py_vertices = PyList_New(0);
vector< SVertex * > vertices = self->ss->getVertexList();
vector< SVertex * >::iterator it;
+ PyObject *py_vertices = PyList_New(vertices.size());
+ unsigned int i = 0;
for (it = vertices.begin(); it != vertices.end(); it++) {
- PyList_Append(py_vertices, BPy_SVertex_from_SVertex(*(*it)));
+ PyList_SET_ITEM(py_vertices, i++, BPy_SVertex_from_SVertex(*(*it)));
}
return py_vertices;
@@ -246,13 +247,14 @@ PyDoc_STRVAR(SShape_edges_doc,
static PyObject *SShape_edges_get(BPy_SShape *self, void *UNUSED(closure))
{
- PyObject *py_edges = PyList_New(0);
vector< FEdge * > edges = self->ss->getEdgeList();
vector< FEdge * >::iterator it;
+ PyObject *py_edges = PyList_New(edges.size());
+ unsigned int i = 0;
for (it = edges.begin(); it != edges.end(); it++) {
- PyList_Append(py_edges, Any_BPy_FEdge_from_FEdge(*(*it)));
+ PyList_SET_ITEM(py_edges, i++, Any_BPy_FEdge_from_FEdge(*(*it)));
}
return py_edges;