Gui: use correct cast with getActiveView

This commit is contained in:
jffmichi
2025-07-10 01:51:39 +02:00
parent da6a08acfe
commit fea703c8be
3 changed files with 10 additions and 13 deletions

View File

@@ -142,14 +142,13 @@ void TextureMapping::onFileChooserFileNameSelected(const QString& s)
if (!this->grp) {
Gui::Document* doc = Gui::Application::Instance->activeDocument();
if (doc) {
Gui::MDIView* mdi = doc->getActiveView();
if (mdi && mdi->isDerivedFrom<View3DInventor>()) {
Gui::View3DInventorViewer* view = static_cast<View3DInventor*>(mdi)->getViewer();
this->grp = static_cast<SoGroup *>(view->getSceneGraph());
auto view = qobject_cast<View3DInventor*>(doc->getActiveView());
if (view) {
this->grp = static_cast<SoGroup*>(view->getViewer()->getSceneGraph());
this->grp->ref();
this->grp->insertChild(this->tex,1);
this->grp->insertChild(this->tex, 1);
if (ui->checkEnv->isChecked())
this->grp->insertChild(this->env,2);
this->grp->insertChild(this->env, 2);
}
}
}