From 5c19fe2e74716788c57fe8584c8dae3f2da8a3f1 Mon Sep 17 00:00:00 2001 From: wmayer Date: Tue, 8 Nov 2016 16:41:36 +0100 Subject: [PATCH] move addDisplayMode from ViewProviderPythonFeaturePy to ViewProviderPy --- src/Gui/ViewProviderPy.xml | 9 ++++++-- src/Gui/ViewProviderPyImp.cpp | 27 ++++++++++++++++++++-- src/Gui/ViewProviderPythonFeaturePy.xml | 7 +----- src/Gui/ViewProviderPythonFeaturePyImp.cpp | 24 ------------------- 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/src/Gui/ViewProviderPy.xml b/src/Gui/ViewProviderPy.xml index e44d383d78..da0a277bc1 100644 --- a/src/Gui/ViewProviderPy.xml +++ b/src/Gui/ViewProviderPy.xml @@ -28,7 +28,12 @@ Check if the object is visible - + + + Add a new display mode to the view provider + + + Show a list of all display modes @@ -83,4 +88,4 @@ - + diff --git a/src/Gui/ViewProviderPyImp.cpp b/src/Gui/ViewProviderPyImp.cpp index f3ae09cc82..1cc3c2d576 100644 --- a/src/Gui/ViewProviderPyImp.cpp +++ b/src/Gui/ViewProviderPyImp.cpp @@ -37,8 +37,8 @@ #include "WidgetFactory.h" // inclusion of the generated files (generated out of ViewProviderPy2.xml) -#include "ViewProviderPy.h" -#include "ViewProviderPy.cpp" +#include +#include #include #include #include @@ -82,6 +82,29 @@ PyObject* ViewProviderPy::isVisible(PyObject *args) } PY_CATCH; } +PyObject* ViewProviderPy::addDisplayMode(PyObject * args) +{ + char* mode; + PyObject* obj; + if (!PyArg_ParseTuple(args, "Os", &obj, &mode)) + return NULL; + + void* ptr = 0; + try { + Base::Interpreter().convertSWIGPointerObj("pivy.coin","SoNode *", obj, &ptr, 0); + } + catch (const Base::Exception& e) { + PyErr_SetString(PyExc_RuntimeError, e.what()); + return 0; + } + + PY_TRY { + SoNode* node = reinterpret_cast(ptr); + getViewProviderPtr()->addDisplayMaskMode(node,mode); + Py_Return; + } PY_CATCH; +} + PyObject* ViewProviderPy::listDisplayModes(PyObject *args) { if (!PyArg_ParseTuple(args, "")) // convert args: Python->C diff --git a/src/Gui/ViewProviderPythonFeaturePy.xml b/src/Gui/ViewProviderPythonFeaturePy.xml index 02413d2eed..e7b882de28 100644 --- a/src/Gui/ViewProviderPythonFeaturePy.xml +++ b/src/Gui/ViewProviderPythonFeaturePy.xml @@ -13,11 +13,6 @@ This is the view provider class for Python features - - - Add a new display mode to the view provider - - @@ -41,4 +36,4 @@ - + diff --git a/src/Gui/ViewProviderPythonFeaturePyImp.cpp b/src/Gui/ViewProviderPythonFeaturePyImp.cpp index 2bbbdbbc45..c13cc5f5a8 100644 --- a/src/Gui/ViewProviderPythonFeaturePyImp.cpp +++ b/src/Gui/ViewProviderPythonFeaturePyImp.cpp @@ -22,7 +22,6 @@ #include "PreCompiled.h" #ifndef _PreComp_ -# include #endif #include "Gui/ViewProviderPythonFeature.h" @@ -40,29 +39,6 @@ std::string ViewProviderPythonFeaturePy::representation(void) const return ""; } -PyObject* ViewProviderPythonFeaturePy::addDisplayMode(PyObject * args) -{ - char* mode; - PyObject* obj; - if (!PyArg_ParseTuple(args, "Os", &obj, &mode)) - return NULL; - - void* ptr = 0; - try { - Base::Interpreter().convertSWIGPointerObj("pivy.coin","SoNode *", obj, &ptr, 0); - } - catch (const Base::Exception& e) { - PyErr_SetString(PyExc_RuntimeError, e.what()); - return 0; - } - - PY_TRY { - SoNode* node = reinterpret_cast(ptr); - getViewProviderPythonFeaturePtr()->addDisplayMaskMode(node,mode); - Py_Return; - } PY_CATCH; -} - PyObject* ViewProviderPythonFeaturePy::addProperty(PyObject *args) { char *sType,*sName=0,*sGroup=0,*sDoc=0;