Extensions: Fix rebase errors
This commit is contained in:
parent
594bb4fecd
commit
1287f3007a
|
@ -1137,11 +1137,14 @@ void Application::initTypes(void)
|
|||
|
||||
// Extension classes
|
||||
App ::Extension ::init();
|
||||
App ::ExtensionContainer ::init();
|
||||
App ::DocumentObjectExtension ::init();
|
||||
App ::GroupExtension ::init();
|
||||
App ::GroupExtensionPython ::init();
|
||||
App ::GeoFeatureGroupExtension ::init();
|
||||
App ::GeoFeatureGroupExtensionPython::init();
|
||||
App ::OriginGroupExtension ::init();
|
||||
App ::OriginGroupExtensionPython::init();
|
||||
|
||||
// Document classes
|
||||
App ::TransactionalObject ::init();
|
||||
|
|
|
@ -61,7 +61,7 @@ namespace App {
|
|||
/// @cond DOXERR
|
||||
PROPERTY_SOURCE_TEMPLATE(App::DocumentObjectGroupPython, App::DocumentObjectGroup)
|
||||
template<> const char* App::DocumentObjectGroupPython::getViewProviderName(void) const {
|
||||
return "Gui::ViewProviderGroupExtensionPython";
|
||||
return "Gui::ViewProviderDocumentObjectGroupPython";
|
||||
}
|
||||
template<> PyObject* App::DocumentObjectGroupPython::getPyObject(void) {
|
||||
if (PythonObject.is(Py::_None())) {
|
||||
|
|
|
@ -89,8 +89,9 @@ std::string PropertyFileIncluded::getDocTransientPath(void) const
|
|||
{
|
||||
std::string path;
|
||||
PropertyContainer *co = getContainer();
|
||||
if (co->isDerivedFrom(DocumentObject::getClassTypeId())) {
|
||||
path = static_cast<DocumentObject*>(co)->getDocument()->TransientDir.getValue();
|
||||
auto obj = dynamic_cast<DocumentObject*>(co);
|
||||
if (obj) {
|
||||
path = obj->getDocument()->TransientDir.getValue();
|
||||
std::replace(path.begin(), path.end(), '\\', '/');
|
||||
}
|
||||
return path;
|
||||
|
|
|
@ -275,27 +275,28 @@ FreeCADGui_subgraphFromObject(PyObject * /*self*/, PyObject *args)
|
|||
SoNode* node = 0;
|
||||
try {
|
||||
Base::BaseClass* base = static_cast<Base::BaseClass*>(Base::Type::createInstanceByName(vp.c_str(), true));
|
||||
if (base && base->getTypeId().isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) {
|
||||
std::unique_ptr<Gui::ViewProviderDocumentObject> vp(static_cast<Gui::ViewProviderDocumentObject*>(base));
|
||||
std::map<std::string, App::Property*> Map;
|
||||
obj->getPropertyMap(Map);
|
||||
vp->attach(obj);
|
||||
for (std::map<std::string, App::Property*>::iterator it = Map.begin(); it != Map.end(); ++it) {
|
||||
vp->updateData(it->second);
|
||||
}
|
||||
//throws if dynamic_cast fails, hence no check needed
|
||||
std::unique_ptr<Gui::ViewProviderDocumentObject> vp(dynamic_cast<Gui::ViewProviderDocumentObject*>(base));
|
||||
|
||||
std::vector<std::string> modes = vp->getDisplayModes();
|
||||
if (!modes.empty())
|
||||
vp->setDisplayMode(modes.front().c_str());
|
||||
node = vp->getRoot()->copy();
|
||||
node->ref();
|
||||
std::string type = "So";
|
||||
type += node->getTypeId().getName().getString();
|
||||
type += " *";
|
||||
PyObject* proxy = 0;
|
||||
proxy = Base::Interpreter().createSWIGPointerObj("pivy.coin", type.c_str(), (void*)node, 1);
|
||||
return Py::new_reference_to(Py::Object(proxy, true));
|
||||
std::map<std::string, App::Property*> Map;
|
||||
obj->getPropertyMap(Map);
|
||||
vp->attach(obj);
|
||||
for (std::map<std::string, App::Property*>::iterator it = Map.begin(); it != Map.end(); ++it) {
|
||||
vp->updateData(it->second);
|
||||
}
|
||||
|
||||
std::vector<std::string> modes = vp->getDisplayModes();
|
||||
if (!modes.empty())
|
||||
vp->setDisplayMode(modes.front().c_str());
|
||||
node = vp->getRoot()->copy();
|
||||
node->ref();
|
||||
std::string type = "So";
|
||||
type += node->getTypeId().getName().getString();
|
||||
type += " *";
|
||||
PyObject* proxy = 0;
|
||||
proxy = Base::Interpreter().createSWIGPointerObj("pivy.coin", type.c_str(), (void*)node, 1);
|
||||
return Py::new_reference_to(Py::Object(proxy, true));
|
||||
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
if (node) node->unref();
|
||||
|
|
|
@ -420,9 +420,10 @@ void Document::slotNewObject(const App::DocumentObject& Obj)
|
|||
setModified(true);
|
||||
Base::BaseClass* base = static_cast<Base::BaseClass*>(Base::Type::createInstanceByName(cName.c_str(),true));
|
||||
if (base) {
|
||||
pcProvider = dynamic_cast<ViewProviderDocumentObject*>(base);
|
||||
// type not derived from ViewProviderDocumentObject!!!
|
||||
assert(base->getTypeId().isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId()));
|
||||
pcProvider = static_cast<ViewProviderDocumentObject*>(base);
|
||||
assert(pcProvider);
|
||||
|
||||
d->_ViewProviderMap[&Obj] = pcProvider;
|
||||
|
||||
try {
|
||||
|
|
|
@ -71,8 +71,9 @@ void TreeView::mouseDoubleClickEvent (QMouseEvent * event)
|
|||
if (!view) return;
|
||||
getMainWindow()->setActiveWindow(view);
|
||||
}
|
||||
else if (item->getTypeId().isDerivedFrom(ViewProvider::getClassTypeId())) {
|
||||
if (static_cast<ViewProvider*>(item)->doubleClicked() == false)
|
||||
else {
|
||||
auto* vp = dynamic_cast<ViewProvider*>(item);
|
||||
if (vp && vp->doubleClicked() == false)
|
||||
QTreeView::mouseDoubleClickEvent(event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,8 +297,9 @@ QString PropertyItem::pythonIdentifier(const App::Property* prop) const
|
|||
return QString::fromLatin1("FreeCAD.getDocument(\"%1\").getObject(\"%2\").%3")
|
||||
.arg(docName).arg(objName).arg(propName);
|
||||
}
|
||||
if (parent->getTypeId().isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) {
|
||||
App::DocumentObject* obj = static_cast<Gui::ViewProviderDocumentObject*>(parent)->getObject();
|
||||
auto* vp = dynamic_cast<Gui::ViewProviderDocumentObject*>(parent);
|
||||
if (vp) {
|
||||
App::DocumentObject* obj = vp->getObject();
|
||||
App::Document* doc = obj->getDocument();
|
||||
QString docName = QString::fromLatin1(App::GetApplication().getDocumentName(doc));
|
||||
QString objName = QString::fromLatin1(obj->getNameInDocument());
|
||||
|
|
Loading…
Reference in New Issue
Block a user