Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * ***** BEGIN GPL LICENSE BLOCK ***** | |
3 * | |
4 * This program is free software; you can redistribute it and/or | |
5 * modify it under the terms of the GNU General Public License | |
6 * as published by the Free Software Foundation; either version 2 | |
7 * of the License, or (at your option) any later version. | |
8 * | |
9 * This program is distributed in the hope that it will be useful, | |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 * GNU General Public License for more details. | |
13 * | |
14 * You should have received a copy of the GNU General Public License | |
15 * along with this program; if not, write to the Free Software Foundation, | |
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
17 * | |
18 * The Original Code is Copyright (C) 2010 Blender Foundation. | |
19 * All rights reserved. | |
20 * | |
21 * The Original Code is: all of this file. | |
22 * | |
23 * Contributor(s): none yet. | |
24 * | |
25 * ***** END GPL LICENSE BLOCK ***** | |
26 */ | |
27 | |
28 /** \file source/blender/freestyle/intern/python/UnaryPredicate1D/BPy_ShapeUP1D. cpp | |
29 * \ingroup freestyle | |
30 */ | |
31 | |
32 #include "BPy_ShapeUP1D.h" | |
33 | |
34 #ifdef __cplusplus | |
35 extern "C" { | |
36 #endif | |
37 | |
38 //////////////////////////////////////////////////////////////////////////////// /////////// | |
39 | |
40 //------------------------INSTANCE METHODS ---------------------------------- | |
41 | |
42 static char ShapeUP1D___doc__[] = | |
43 "Class hierarchy: :class:`UnaryPredicate1D` > :class:`ShapeUP1D`\n" | |
44 "\n" | |
45 ".. method:: __init__(first, second=0)\n" | |
46 "\n" | |
47 " Builds a ShapeUP1D object.\n" | |
48 "\n" | |
49 " :arg first: The first Id component.\n" | |
50 " :type first: int\n" | |
51 " :arg second: The second Id component.\n" | |
52 " :type second: int\n" | |
53 "\n" | |
54 ".. method:: __call__(inter)\n" | |
55 "\n" | |
56 " Returns true if the shape to which the Interface1D belongs to has\n" | |
57 " the same :class:`Id` as the one specified by the user.\n" | |
58 "\n" | |
59 " :arg inter: An Interface1D object.\n" | |
60 " :type inter: :class:`Interface1D`\n" | |
61 " :return: True if Interface1D belongs to the shape of the\n" | |
62 " user-specified Id.\n" | |
63 " :rtype: bool\n"; | |
64 | |
65 static int ShapeUP1D___init__(BPy_ShapeUP1D* self, PyObject *args, PyObject *kwd s) | |
66 { | |
67 static const char *kwlist[] = {"first", "second", NULL}; | |
68 unsigned u1, u2 = 0; | |
69 | |
70 if (!PyArg_ParseTupleAndKeywords(args, kwds, "I|I", (char **)kwlist, &u1 , &u2)) | |
71 return -1; | |
72 self->py_up1D.up1D = new Predicates1D::ShapeUP1D(u1, u2); | |
ideasman42
2013/03/02 10:56:47
Is this freed? - looks like it could be a memory l
kjym3
2013/03/03 01:58:03
Yes, self->py_up1D.up1D is freed in the destructor
| |
73 return 0; | |
74 } | |
75 | |
76 /*-----------------------BPy_ShapeUP1D type definition ------------------------- -----*/ | |
77 | |
78 PyTypeObject ShapeUP1D_Type = { | |
79 PyVarObject_HEAD_INIT(NULL, 0) | |
80 "ShapeUP1D", /* tp_name */ | |
81 sizeof(BPy_ShapeUP1D), /* tp_basicsize */ | |
82 0, /* tp_itemsize */ | |
83 0, /* tp_dealloc */ | |
84 0, /* tp_print */ | |
85 0, /* tp_getattr */ | |
86 0, /* tp_setattr */ | |
87 0, /* tp_reserved */ | |
88 0, /* tp_repr */ | |
89 0, /* tp_as_number */ | |
90 0, /* tp_as_sequence */ | |
91 0, /* tp_as_mapping */ | |
92 0, /* tp_hash */ | |
93 0, /* tp_call */ | |
94 0, /* tp_str */ | |
95 0, /* tp_getattro */ | |
96 0, /* tp_setattro */ | |
97 0, /* tp_as_buffer */ | |
98 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ | |
99 ShapeUP1D___doc__, /* tp_doc */ | |
100 0, /* tp_traverse */ | |
101 0, /* tp_clear */ | |
102 0, /* tp_richcompare */ | |
103 0, /* tp_weaklistoffset */ | |
104 0, /* tp_iter */ | |
105 0, /* tp_iternext */ | |
106 0, /* tp_methods */ | |
107 0, /* tp_members */ | |
108 0, /* tp_getset */ | |
109 &UnaryPredicate1D_Type, /* tp_base */ | |
110 0, /* tp_dict */ | |
111 0, /* tp_descr_get */ | |
112 0, /* tp_descr_set */ | |
113 0, /* tp_dictoffset */ | |
114 (initproc)ShapeUP1D___init__, /* tp_init */ | |
115 0, /* tp_alloc */ | |
116 0, /* tp_new */ | |
117 }; | |
118 | |
119 //////////////////////////////////////////////////////////////////////////////// /////////// | |
120 | |
121 #ifdef __cplusplus | |
122 } | |
123 #endif | |
OLD | NEW |