--- a/gui.cpp Mon Apr 15 02:56:42 2013 +0300 +++ b/gui.cpp Mon Apr 15 04:00:10 2013 +0300 @@ -83,6 +83,7 @@ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // ========================================================================= // ForgeWindow::ForgeWindow () { + g_ForgeWindow = this; R = new GLRenderer; qObjList = new QTreeWidget; @@ -578,6 +579,23 @@ // If we have no selection, disable splitting quads ACTION (splitQuads)->setEnabled (qObjList->selectedItems().size() > 0); */ + + // Update the shared selection array, unless this was called during GL picking, + // in which case the GL renderer takes care of the selection. + if (R->bPicking == false) { + std::vector<LDObject*> paPriorSelection = paSelection; + paSelection = getSelectedObjects (); + + // Update the GL renderer + for (LDObject* obj : paSelection) + R->recompileObject (obj); + + for (LDObject* obj : paPriorSelection) + R->recompileObject (obj); + + R->updateSelFlash (); + R->refresh (); + } } // ========================================================================= // @@ -657,7 +675,11 @@ std::vector<LDObject*> ForgeWindow::getSelectedObjects () { std::vector<LDObject*> objs; - QList<QTreeWidgetItem*> const qaItems = qObjList->selectedItems(); + if (g_CurrentFile == nullptr) + return objs; + + QList<QTreeWidgetItem*> const qaItems = qObjList->selectedItems (); + for (LDObject* obj : g_CurrentFile->objects) for (QTreeWidgetItem* qItem : qaItems) { if (qItem == obj->qObjListEntry) {