Make FeaturePython Python binding a template class to avoid code duplication

This commit is contained in:
wmayer
2013-03-22 00:34:18 +01:00
parent 9da66cbb02
commit ce0e6e5cef
30 changed files with 508 additions and 506 deletions

View File

@@ -50,10 +50,10 @@
#include <Base/Stream.h>
#include <Base/Placement.h>
#include <Base/Rotation.h>
#include <App/FeaturePythonPyImp.h>
#include "PartFeature.h"
#include "PartFeaturePy.h"
#include "FeaturePythonPy.h"
using namespace Part;
@@ -274,13 +274,12 @@ PROPERTY_SOURCE_TEMPLATE(Part::FeaturePython, Part::Feature)
template<> const char* Part::FeaturePython::getViewProviderName(void) const {
return "PartGui::ViewProviderPython";
}
template<> PyObject* Part::FeaturePython::getPyObject(void) {
if (PythonObject.is(Py::_None())){
if (PythonObject.is(Py::_None())) {
// ref counter is set to 1
PythonObject = Py::Object(new Part::FeaturePythonPy(this),true);
PythonObject = Py::Object(new FeaturePythonPyT<Part::PartFeaturePy>(this),true);
}
return Py::new_reference_to(PythonObject);
return Py::new_reference_to(PythonObject);
}
/// @endcond