Base: remove explicit namespace-name qualifier from *PyImp.cpp
Explicit Base namespace-name is used randomly across PyImp sources. Remove it.
This commit is contained in:
committed by
Benjamin Nauck
parent
3769dfd338
commit
8ba8c04b20
@@ -69,8 +69,8 @@ int VectorPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
||||
return 0;
|
||||
}
|
||||
PyErr_Clear(); // set by PyArg_ParseTuple()
|
||||
if (PyArg_ParseTuple(args, "O!", &(Base::VectorPy::Type), &object)) {
|
||||
*ptr = *(static_cast<Base::VectorPy*>(object)->getVectorPtr());
|
||||
if (PyArg_ParseTuple(args, "O!", &(VectorPy::Type), &object)) {
|
||||
*ptr = *(static_cast<VectorPy*>(object)->getVectorPtr());
|
||||
return 0;
|
||||
}
|
||||
PyErr_Clear(); // set by PyArg_ParseTuple()
|
||||
@@ -96,10 +96,10 @@ PyObject* VectorPy::__reduce__(PyObject* args) const
|
||||
|
||||
Py::Tuple tuple(2);
|
||||
|
||||
Py::Object type(Base::getTypeAsObject(&Base::VectorPy::Type));
|
||||
Py::Object type(getTypeAsObject(&VectorPy::Type));
|
||||
tuple.setItem(0, type);
|
||||
|
||||
Base::Vector3d v = this->value();
|
||||
Vector3d v = this->value();
|
||||
Py::Tuple xyz(3);
|
||||
xyz.setItem(0, Py::Float(v.x));
|
||||
xyz.setItem(1, Py::Float(v.y));
|
||||
@@ -118,8 +118,8 @@ PyObject* VectorPy::number_add_handler(PyObject* self, PyObject* other)
|
||||
PyErr_SetString(PyExc_TypeError, "Second arg must be Vector");
|
||||
return nullptr;
|
||||
}
|
||||
Base::Vector3d a = static_cast<VectorPy*>(self)->value();
|
||||
Base::Vector3d b = static_cast<VectorPy*>(other)->value();
|
||||
Vector3d a = static_cast<VectorPy*>(self)->value();
|
||||
Vector3d b = static_cast<VectorPy*>(other)->value();
|
||||
return new VectorPy(a + b);
|
||||
}
|
||||
|
||||
@@ -133,18 +133,18 @@ PyObject* VectorPy::number_subtract_handler(PyObject* self, PyObject* other)
|
||||
PyErr_SetString(PyExc_TypeError, "Second arg must be Vector");
|
||||
return nullptr;
|
||||
}
|
||||
Base::Vector3d a = static_cast<VectorPy*>(self)->value();
|
||||
Base::Vector3d b = static_cast<VectorPy*>(other)->value();
|
||||
Vector3d a = static_cast<VectorPy*>(self)->value();
|
||||
Vector3d b = static_cast<VectorPy*>(other)->value();
|
||||
return new VectorPy(a - b);
|
||||
}
|
||||
|
||||
PyObject* VectorPy::number_multiply_handler(PyObject* self, PyObject* other)
|
||||
{
|
||||
if (PyObject_TypeCheck(self, &(VectorPy::Type))) {
|
||||
Base::Vector3d a = static_cast<VectorPy*>(self)->value();
|
||||
Vector3d a = static_cast<VectorPy*>(self)->value();
|
||||
|
||||
if (PyObject_TypeCheck(other, &(VectorPy::Type))) {
|
||||
Base::Vector3d b = static_cast<VectorPy*>(other)->value();
|
||||
Vector3d b = static_cast<VectorPy*>(other)->value();
|
||||
Py::Float mult(a * b);
|
||||
return Py::new_reference_to(mult);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ PyObject* VectorPy::number_multiply_handler(PyObject* self, PyObject* other)
|
||||
return nullptr;
|
||||
}
|
||||
if (PyObject_TypeCheck(other, &(VectorPy::Type))) {
|
||||
Base::Vector3d a = static_cast<VectorPy*>(other)->value();
|
||||
Vector3d a = static_cast<VectorPy*>(other)->value();
|
||||
if (PyNumber_Check(self)) {
|
||||
double b = PyFloat_AsDouble(self);
|
||||
return new VectorPy(a * b);
|
||||
@@ -190,7 +190,7 @@ PyObject* VectorPy::sequence_item(PyObject* self, Py_ssize_t index)
|
||||
}
|
||||
|
||||
unsigned short pos = index % 3;
|
||||
Base::Vector3d vec = self_->value();
|
||||
Vector3d vec = self_->value();
|
||||
Py::Float item {vec[pos]};
|
||||
self_->sequence.setItem(pos, item);
|
||||
|
||||
@@ -249,7 +249,7 @@ PyObject* VectorPy::mapping_subscript(PyObject* self, PyObject* item)
|
||||
}
|
||||
if (start == 0 && step == 1 && slicelength == sequence_length(self)
|
||||
&& PyObject_TypeCheck(self, &(VectorPy::Type))) {
|
||||
Base::Vector3d v = static_cast<VectorPy*>(self)->value();
|
||||
Vector3d v = static_cast<VectorPy*>(self)->value();
|
||||
Py::Tuple xyz(3);
|
||||
xyz.setItem(0, Py::Float(v.x));
|
||||
xyz.setItem(1, Py::Float(v.y));
|
||||
@@ -257,7 +257,7 @@ PyObject* VectorPy::mapping_subscript(PyObject* self, PyObject* item)
|
||||
return Py::new_reference_to(xyz);
|
||||
}
|
||||
if (PyObject_TypeCheck(self, &(VectorPy::Type))) {
|
||||
Base::Vector3d v = static_cast<VectorPy*>(self)->value();
|
||||
Vector3d v = static_cast<VectorPy*>(self)->value();
|
||||
Py::Tuple xyz(static_cast<size_t>(slicelength));
|
||||
|
||||
for (cur = start, i = 0; i < slicelength; cur += step, i++) {
|
||||
@@ -287,7 +287,7 @@ PyObject* VectorPy::add(PyObject* args) const
|
||||
VectorPy::PointerType this_ptr = getVectorPtr();
|
||||
VectorPy::PointerType vect_ptr = vec->getVectorPtr();
|
||||
|
||||
Base::Vector3d v = (*this_ptr) + (*vect_ptr);
|
||||
Vector3d v = (*this_ptr) + (*vect_ptr);
|
||||
return new VectorPy(v);
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ PyObject* VectorPy::sub(PyObject* args) const
|
||||
VectorPy::PointerType this_ptr = getVectorPtr();
|
||||
VectorPy::PointerType vect_ptr = vec->getVectorPtr();
|
||||
|
||||
Base::Vector3d v = (*this_ptr) - (*vect_ptr);
|
||||
Vector3d v = (*this_ptr) - (*vect_ptr);
|
||||
return new VectorPy(v);
|
||||
}
|
||||
|
||||
@@ -314,7 +314,7 @@ PyObject* VectorPy::negative(PyObject* args) const
|
||||
}
|
||||
|
||||
VectorPy::PointerType this_ptr = getVectorPtr();
|
||||
Base::Vector3d v = -(*this_ptr);
|
||||
Vector3d v = -(*this_ptr);
|
||||
return new VectorPy(v);
|
||||
}
|
||||
|
||||
@@ -448,7 +448,7 @@ PyObject* VectorPy::cross(PyObject* args) const
|
||||
VectorPy::PointerType this_ptr = getVectorPtr();
|
||||
VectorPy::PointerType vect_ptr = vec->getVectorPtr();
|
||||
|
||||
Base::Vector3d v = (*this_ptr) % (*vect_ptr);
|
||||
Vector3d v = (*this_ptr) % (*vect_ptr);
|
||||
return new VectorPy(v);
|
||||
}
|
||||
|
||||
@@ -503,7 +503,7 @@ PyObject* VectorPy::normalize(PyObject* args)
|
||||
}
|
||||
VectorPy::PointerType ptr = getVectorPtr();
|
||||
if (ptr->Length() < Vector3d::epsilon()) {
|
||||
PyErr_SetString(Base::PyExc_FC_GeneralError, "Cannot normalize null vector");
|
||||
PyErr_SetString(PyExc_FC_GeneralError, "Cannot normalize null vector");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -579,7 +579,7 @@ PyObject* VectorPy::distanceToPoint(PyObject* args) const
|
||||
VectorPy::PointerType this_ptr = getVectorPtr();
|
||||
VectorPy::PointerType base_ptr = base_vec->getVectorPtr();
|
||||
|
||||
Py::Float dist(Base::Distance(*this_ptr, *base_ptr));
|
||||
Py::Float dist(Distance(*this_ptr, *base_ptr));
|
||||
return Py::new_reference_to(dist);
|
||||
}
|
||||
|
||||
@@ -748,7 +748,7 @@ PyObject* VectorPy::number_divide_handler(PyObject* self, PyObject* other)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Base::Vector3d vec = static_cast<VectorPy*>(self)->value();
|
||||
Vector3d vec = static_cast<VectorPy*>(self)->value();
|
||||
double div = PyFloat_AsDouble(other);
|
||||
if (div == 0.0) {
|
||||
PyErr_Format(PyExc_ZeroDivisionError, "'%s' division by zero", Py_TYPE(self)->tp_name);
|
||||
@@ -770,8 +770,8 @@ PyObject* VectorPy::number_remainder_handler(PyObject* self, PyObject* other)
|
||||
{
|
||||
if (PyObject_TypeCheck(self, &(VectorPy::Type))
|
||||
&& PyObject_TypeCheck(other, &(VectorPy::Type))) {
|
||||
Base::Vector3d a = static_cast<VectorPy*>(self)->value();
|
||||
Base::Vector3d b = static_cast<VectorPy*>(other)->value();
|
||||
Vector3d a = static_cast<VectorPy*>(self)->value();
|
||||
Vector3d b = static_cast<VectorPy*>(other)->value();
|
||||
return new VectorPy(a % b);
|
||||
}
|
||||
|
||||
@@ -803,7 +803,7 @@ PyObject* VectorPy::number_power_handler(PyObject* self, PyObject* other, PyObje
|
||||
PyObject* VectorPy::number_negative_handler(PyObject* self)
|
||||
{
|
||||
if (PyObject_TypeCheck(self, &(VectorPy::Type))) {
|
||||
Base::Vector3d vec = static_cast<VectorPy*>(self)->value();
|
||||
Vector3d vec = static_cast<VectorPy*>(self)->value();
|
||||
return new VectorPy(-vec);
|
||||
}
|
||||
|
||||
@@ -814,7 +814,7 @@ PyObject* VectorPy::number_negative_handler(PyObject* self)
|
||||
PyObject* VectorPy::number_positive_handler(PyObject* self)
|
||||
{
|
||||
if (PyObject_TypeCheck(self, &(VectorPy::Type))) {
|
||||
Base::Vector3d vec = static_cast<VectorPy*>(self)->value();
|
||||
Vector3d vec = static_cast<VectorPy*>(self)->value();
|
||||
return new VectorPy(vec);
|
||||
}
|
||||
|
||||
@@ -825,7 +825,7 @@ PyObject* VectorPy::number_positive_handler(PyObject* self)
|
||||
PyObject* VectorPy::number_absolute_handler(PyObject* self)
|
||||
{
|
||||
if (PyObject_TypeCheck(self, &(VectorPy::Type))) {
|
||||
Base::Vector3d vec = static_cast<VectorPy*>(self)->value();
|
||||
Vector3d vec = static_cast<VectorPy*>(self)->value();
|
||||
vec.x = fabs(vec.x);
|
||||
vec.y = fabs(vec.y);
|
||||
vec.z = fabs(vec.z);
|
||||
|
||||
Reference in New Issue
Block a user