59 return PyBool_FromLong(
b ? 1 : 0);
64 BLI_assert(ty->tp_basicsize ==
sizeof(PyLongObject));
65 PyLongObject *result = PyObject_NewVar(PyLongObject, ty, 1);
66 PyLongObject *value_py = (PyLongObject *)PyLong_FromLong(value);
67 memcpy(&result->long_value, &value_py->long_value,
sizeof(result->long_value));
69 return (PyObject *)result;
75 PyDict_SetItemString(dict, attr, result);
83 vec_data[0] = vec.
x();
84 vec_data[1] = vec.
y();
91 vec_data[0] = vec.
x();
92 vec_data[1] = vec.
y();
93 vec_data[2] = vec.
z();
100 vec_data[0] = vec.
x();
101 vec_data[1] = vec.
y();
102 vec_data[2] = vec.
z();
109 ((
BPy_Id *)py_id)->id =
new Id(
id.getFirst(),
id.getSecond());
121 if (
typeid(if0D) ==
typeid(
SVertex)) {
130 if (
typeid(if0D) ==
typeid(
TVertex)) {
137 PyErr_SetString(PyExc_TypeError, msg.c_str());
143 if (
typeid(if1D) ==
typeid(
ViewEdge)) {
146 if (
typeid(if1D) ==
typeid(
Chain)) {
149 if (
typeid(if1D) ==
typeid(
Stroke)) {
158 if (
typeid(if1D) ==
typeid(
FEdge)) {
165 PyErr_SetString(PyExc_TypeError, msg.c_str());
177 if (
typeid(fe) ==
typeid(
FEdge)) {
181 PyErr_SetString(PyExc_TypeError, msg.c_str());
190 if (
typeid(vv) ==
typeid(
TVertex)) {
197 PyErr_SetString(PyExc_TypeError, msg.c_str());
251 ((
BPy_FEdge *)py_fe)->py_if1D.borrowed =
true;
257 PyObject *args = PyTuple_New(1);
258 PyTuple_SET_ITEM(args, 0, PyLong_FromLong(n));
269 ((
BPy_Stroke *)py_s)->py_if1D.borrowed =
true;
283 PyObject *args = PyTuple_New(1);
284 PyTuple_SET_ITEM(args, 0, PyLong_FromLong(n));
325 ((
BPy_TVertex *)py_tv)->py_vv.py_if0D.borrowed =
true;
351 ((
BPy_Chain *)py_c)->py_c.py_if1D.borrowed =
true;
381 PyObject *args = PyTuple_New(1);
382 PyTuple_SET_ITEM(args, 0, PyLong_FromLong(i));
404 PyObject *py_dve = PyTuple_New(2);
520 return PyObject_IsTrue(
b) != 0;
662 for (
int i = 0; i < n; i++) {
663 v[i] = PyFloat_AsDouble(PyList_GET_ITEM(obj, i));
664 if (
v[i] == -1.0f && PyErr_Occurred()) {
665 PyErr_SetString(PyExc_TypeError,
"list elements must be a number");
676 if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 2) {
691 if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 3) {
707 if (!PyList_Check(obj) || PyList_GET_SIZE(obj) != 3) {
721 for (
int i = 0; i < n; i++) {
722 v[i] = PyFloat_AsDouble(PyTuple_GET_ITEM(obj, i));
723 if (
v[i] == -1.0f && PyErr_Occurred()) {
724 PyErr_SetString(PyExc_TypeError,
"tuple elements must be a number");
735 if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 2) {
750 if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 3) {
766 if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 3) {
787 for (
int i = 0; i < n; i++) {
796 for (
int i = 0; i < n; i++) {
801 if (PyList_Check(obj) && PyList_GET_SIZE(obj) == n) {
804 if (PyTuple_Check(obj) && PyTuple_GET_SIZE(obj) == n) {
PyTypeObject AdjacencyIterator_Type
PyTypeObject ChainPredicateIterator_Type
PyTypeObject ChainSilhouetteIterator_Type
PyTypeObject ChainingIterator_Type
PyObject * BPy_NonTVertex_from_NonTVertex(NonTVertex &ntv)
bool Vec3r_ptr_from_Vector(PyObject *obj, Vec3r &vec)
bool Vec3r_ptr_from_Color(PyObject *obj, Vec3r &vec)
bool Vec2f_ptr_from_Vector(PyObject *obj, Vec2f &vec)
PyObject * BPy_CurvePointIterator_from_CurvePointIterator(CurveInternal::CurvePointIterator &cp_it)
PyObject * BPy_StrokeVertexIterator_from_StrokeVertexIterator(StrokeInternal::StrokeVertexIterator &sv_it, bool reversed)
PyObject * Vector_from_Vec3r(Vec3r &vec)
bool Vec3r_ptr_from_PyList(PyObject *obj, Vec3r &vec)
bool Vec3r_ptr_from_PyTuple(PyObject *obj, Vec3r &vec)
PyObject * BPy_Interface0DIterator_from_Interface0DIterator(Interface0DIterator &if0D_it, bool reversed)
PyObject * BPy_Id_from_Id(Id &id)
PyObject * BPy_StrokeAttribute_from_StrokeAttribute(StrokeAttribute &sa)
bool bool_from_PyBool(PyObject *b)
void PyLong_subtype_add_to_dict(PyObject *dict, PyTypeObject *ty, const char *attr, long value)
PyObject * BPy_ChainPredicateIterator_from_ChainPredicateIterator(ChainPredicateIterator &cp_it)
PyObject * BPy_SVertexIterator_from_SVertexIterator(ViewEdgeInternal::SVertexIterator &sv_it)
bool Vec2f_ptr_from_PyTuple(PyObject *obj, Vec2f &vec)
PyObject * BPy_StrokeVertex_from_StrokeVertex(StrokeVertex &sv)
PyObject * PyLong_subtype_new(PyTypeObject *ty, long value)
bool Vec3f_ptr_from_PyObject(PyObject *obj, Vec3f &vec)
PyObject * BPy_Interface0D_from_Interface0D(Interface0D &if0D)
PyObject * BPy_SShape_from_SShape(SShape &ss)
bool Vec3f_ptr_from_Color(PyObject *obj, Vec3f &vec)
PyObject * BPy_ViewVertex_from_ViewVertex(ViewVertex &vv)
PyObject * BPy_Chain_from_Chain(Chain &c)
PyObject * Any_BPy_Interface1D_from_Interface1D(Interface1D &if1D)
bool Vec2f_ptr_from_PyObject(PyObject *obj, Vec2f &vec)
PyObject * BPy_MediumType_from_MediumType(Stroke::MediumType n)
bool float_array_from_PyObject(PyObject *obj, float *v, int n)
bool Vec3f_ptr_from_PyTuple(PyObject *obj, Vec3f &vec)
PyObject * Any_BPy_FEdge_from_FEdge(FEdge &fe)
Nature::EdgeNature EdgeNature_from_BPy_Nature(PyObject *obj)
PyObject * BPy_orientedViewEdgeIterator_from_orientedViewEdgeIterator(ViewVertexInternal::orientedViewEdgeIterator &ove_it, bool reversed)
PyObject * BPy_FEdgeSmooth_from_FEdgeSmooth(FEdgeSmooth &fes)
PyObject * BPy_FEdgeSharp_from_FEdgeSharp(FEdgeSharp &fes)
bool Vec3f_ptr_from_PyList(PyObject *obj, Vec3f &vec)
PyObject * BPy_Nature_from_Nature(ushort n)
PyObject * BPy_directedViewEdge_from_directedViewEdge(ViewVertex::directedViewEdge &dve)
PyObject * BPy_ViewEdgeIterator_from_ViewEdgeIterator(ViewEdgeInternal::ViewEdgeIterator &ve_it)
PyObject * BPy_Stroke_from_Stroke(Stroke &s)
PyObject * BPy_ChainingIterator_from_ChainingIterator(ChainingIterator &c_it)
PyObject * BPy_CurvePoint_from_CurvePoint(CurvePoint &cp)
PyObject * BPy_ChainSilhouetteIterator_from_ChainSilhouetteIterator(ChainSilhouetteIterator &cs_it)
PyObject * BPy_FEdge_from_FEdge(FEdge &fe)
PyObject * BPy_AdjacencyIterator_from_AdjacencyIterator(AdjacencyIterator &a_it)
int convert_v4(PyObject *obj, void *v)
IntegrationType IntegrationType_from_BPy_IntegrationType(PyObject *obj)
PyObject * BPy_SVertex_from_SVertex(SVertex &sv)
Stroke::MediumType MediumType_from_BPy_MediumType(PyObject *obj)
PyObject * Vector_from_Vec3f(Vec3f &vec)
PyObject * Any_BPy_ViewVertex_from_ViewVertex(ViewVertex &vv)
static bool float_array_from_PyList(PyObject *obj, float *v, int n)
PyObject * BPy_ViewEdge_from_ViewEdge(ViewEdge &ve)
PyObject * Vector_from_Vec2f(Vec2f &vec)
int convert_v3(PyObject *obj, void *v)
PyObject * BPy_IntegrationType_from_IntegrationType(IntegrationType i)
PyObject * BPy_TVertex_from_TVertex(TVertex &tv)
PyObject * PyBool_from_bool(bool b)
bool Vec2f_ptr_from_PyList(PyObject *obj, Vec2f &vec)
PyObject * BPy_ViewShape_from_ViewShape(ViewShape &vs)
PyObject * BPy_Interface1D_from_Interface1D(Interface1D &if1D)
PyObject * BPy_BBox_from_BBox(const BBox< Vec3r > &bb)
bool Vec3f_ptr_from_Vector(PyObject *obj, Vec3f &vec)
bool Vec3r_ptr_from_PyObject(PyObject *obj, Vec3r &vec)
static bool float_array_from_PyTuple(PyObject *obj, float *v, int n)
PyObject * BPy_FrsMaterial_from_FrsMaterial(const FrsMaterial &m)
int convert_v2(PyObject *obj, void *v)
PyObject * Any_BPy_Interface0D_from_Interface0D(Interface0D &if0D)
PyTypeObject CurvePointIterator_Type
PyTypeObject CurvePoint_Type
PyTypeObject FEdgeSharp_Type
PyTypeObject FEdgeSmooth_Type
PyTypeObject FrsMaterial_Type
PyTypeObject IntegrationType_Type
PyTypeObject Interface0DIterator_Type
PyTypeObject Interface0D_Type
PyTypeObject Interface1D_Type
PyTypeObject MediumType_Type
PyTypeObject NonTVertex_Type
PyTypeObject SVertexIterator_Type
PyTypeObject SVertex_Type
PyTypeObject StrokeAttribute_Type
PyTypeObject StrokeVertexIterator_Type
PyTypeObject StrokeVertex_Type
PyTypeObject TVertex_Type
PyTypeObject ViewEdgeIterator_Type
PyTypeObject ViewEdge_Type
PyTypeObject ViewShape_Type
PyTypeObject ViewVertex_Type
PyTypeObject orientedViewEdgeIterator_Type
Class to define the representation of a stroke (for display purpose).
ChainPredicateIterator(bool iRestrictToSelection=true, bool iRestrictToUnvisited=true, ViewEdge *begin=nullptr, bool orientation=true)
ChainSilhouetteIterator(bool iRestrictToSelection=true, ViewEdge *begin=nullptr, bool orientation=true)
ChainingIterator(bool iRestrictToSelection=true, bool iRestrictToUnvisited=true, ViewEdge *begin=nullptr, bool orientation=true)
virtual string getExactTypeName() const
Interface0DIterator(Interface0DIteratorNested *it=nullptr)
virtual string getExactTypeName() const
virtual string getExactTypeName() const
pair< ViewEdge *, bool > directedViewEdge
virtual string getExactTypeName() const
#define BaseMath_ReadCallback(_self)
#define ColorObject_Check(v)
#define VectorObject_Check(v)
VecMat::Vec3< float > Vec3f
VecMat::Vec2< float > Vec2f
VecMat::Vec3< real > Vec3r
ATTR_WARN_UNUSED_RESULT const BMVert * v
PyObject * Vector_CreatePyObject(const float *vec, const int vec_num, PyTypeObject *base_type)
int mathutils_array_parse(float *array, int array_num_min, int array_num_max, PyObject *value, const char *error_prefix)
#define PyTuple_SET_ITEMS(op_arg,...)