SoDetail* ViewProviderPythonFeatureImp::getDetail(const char* name) const { // Run the onChanged method of the proxy object. Base::PyGILStateLocker lock; try { App::Property* proxy = object->getPropertyByName("Proxy"); if (proxy && proxy->getTypeId() == App::PropertyPythonObject::getClassTypeId()) { Py::Object vp = static_cast<App::PropertyPythonObject*>(proxy)->getValue(); if (vp.hasAttr(std::string("getDetail"))) { Py::Callable method(vp.getAttr(std::string("getDetail"))); Py::Tuple args(1); args.setItem(0, Py::String(name)); Py::Object det(method.apply(args)); void* ptr = 0; Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoDetail *", det.ptr(), &ptr, 0); SoDetail* detail = reinterpret_cast<SoDetail*>(ptr); return detail ? detail->copy() : 0; } } } catch (const Base::Exception& e) { e.ReportException(); } catch (Py::Exception&) { Base::PyException e; // extract the Python error text e.ReportException(); } return 0; }
void SoDetailList::copy(const SoDetailList &l) // //////////////////////////////////////////////////////////////////////// { truncate(0); int num = l.getLength(); for (int i = 0; i < num; i ++) { SoDetail* detail = l[i]; if (detail) append(detail->copy()); } }