From 6d03265729f4e126f3ccaaa95e7e3df40bfc4c93 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 26 Sep 2020 22:39:18 +0200 Subject: [PATCH] Gui: [skip ci] fix initialization of Python-based view providers in FreeCADGui.subgraphFromObject --- src/Gui/Application.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index b12752ca32..fd3554ee5e 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -198,6 +198,13 @@ FreeCADGui_subgraphFromObject(PyObject * /*self*/, PyObject *args) std::map Map; obj->getPropertyMap(Map); vp->attach(obj); + + // this is needed to initialize Python-based view providers + App::Property* pyproxy = vp->getPropertyByName("Proxy"); + if (pyproxy && pyproxy->getTypeId() == App::PropertyPythonObject::getClassTypeId()) { + static_cast(pyproxy)->setValue(Py::Long(1)); + } + for (std::map::iterator it = Map.begin(); it != Map.end(); ++it) { vp->updateData(it->second); }