src/glRenderer.cc

changeset 945
c310073e4f22
parent 944
1a6f1997fcbe
child 946
9cbd658b63f9
equal deleted inserted replaced
944:1a6f1997fcbe 945:c310073e4f22
1046 return m_editmode->type(); 1046 return m_editmode->type();
1047 } 1047 }
1048 1048
1049 // ============================================================================= 1049 // =============================================================================
1050 // 1050 //
1051 void GLRenderer::setDocument (LDDocumentPtr const& a) 1051 void GLRenderer::setDocument (LDDocument* const& a)
1052 { 1052 {
1053 m_document = a; 1053 m_document = a;
1054 1054
1055 if (a != null) 1055 if (a != null)
1056 { 1056 {
1401 ev->accept(); 1401 ev->accept();
1402 } 1402 }
1403 1403
1404 // ============================================================================= 1404 // =============================================================================
1405 // 1405 //
1406 LDOverlayPtr GLRenderer::findOverlayObject (ECamera cam) 1406 LDOverlay* GLRenderer::findOverlayObject (ECamera cam)
1407 { 1407 {
1408 for (LDObject* obj : document()->objects()) 1408 for (LDObject* obj : document()->objects())
1409 { 1409 {
1410 LDOverlayPtr overlay = dynamic_cast<LDOverlay*> (obj); 1410 LDOverlay* overlay = dynamic_cast<LDOverlay*> (obj);
1411 1411
1412 if (overlay and overlay->camera() == cam) 1412 if (overlay and overlay->camera() == cam)
1413 return overlay; 1413 return overlay;
1414 } 1414 }
1415 1415
1426 { 1426 {
1427 if (cam == EFreeCamera) 1427 if (cam == EFreeCamera)
1428 continue; 1428 continue;
1429 1429
1430 LDGLOverlay& meta = currentDocumentData().overlays[cam]; 1430 LDGLOverlay& meta = currentDocumentData().overlays[cam];
1431 LDOverlayPtr ovlobj = findOverlayObject (cam); 1431 LDOverlay* ovlobj = findOverlayObject (cam);
1432 1432
1433 if (ovlobj == null and meta.img != null) 1433 if (ovlobj == null and meta.img != null)
1434 { 1434 {
1435 delete meta.img; 1435 delete meta.img;
1436 meta.img = null; 1436 meta.img = null;
1453 { 1453 {
1454 if (cam == EFreeCamera) 1454 if (cam == EFreeCamera)
1455 continue; 1455 continue;
1456 1456
1457 LDGLOverlay& meta = currentDocumentData().overlays[cam]; 1457 LDGLOverlay& meta = currentDocumentData().overlays[cam];
1458 LDOverlayPtr ovlobj = findOverlayObject (cam); 1458 LDOverlay* ovlobj = findOverlayObject (cam);
1459 1459
1460 if (meta.img == null and ovlobj != null) 1460 if (meta.img == null and ovlobj != null)
1461 { 1461 {
1462 // If this is the last overlay image, we need to remove the empty space after it as well. 1462 // If this is the last overlay image, we need to remove the empty space after it as well.
1463 LDObject* nextobj = ovlobj->next(); 1463 LDObject* nextobj = ovlobj->next();
1529 void GLRenderer::highlightCursorObject() 1529 void GLRenderer::highlightCursorObject()
1530 { 1530 {
1531 if (not cfg::HighlightObjectBelowCursor and objectAtCursor() == null) 1531 if (not cfg::HighlightObjectBelowCursor and objectAtCursor() == null)
1532 return; 1532 return;
1533 1533
1534 LDObjectWeakPtr newObject; 1534 LDObject* newObject;
1535 LDObjectWeakPtr oldObject = objectAtCursor(); 1535 LDObject* oldObject = objectAtCursor();
1536 qint32 newIndex; 1536 qint32 newIndex;
1537 1537
1538 if (isCameraMoving() or not cfg::HighlightObjectBelowCursor) 1538 if (isCameraMoving() or not cfg::HighlightObjectBelowCursor)
1539 { 1539 {
1540 newIndex = 0; 1540 newIndex = 0;
1576 void GLRenderer::dropEvent (QDropEvent* ev) 1576 void GLRenderer::dropEvent (QDropEvent* ev)
1577 { 1577 {
1578 if (g_win != null and ev->source() == g_win->getPrimitivesTree()) 1578 if (g_win != null and ev->source() == g_win->getPrimitivesTree())
1579 { 1579 {
1580 QString primName = static_cast<SubfileListItem*> (g_win->getPrimitivesTree()->currentItem())->primitive()->name; 1580 QString primName = static_cast<SubfileListItem*> (g_win->getPrimitivesTree()->currentItem())->primitive()->name;
1581 LDSubfilePtr ref = LDSpawn<LDSubfile>(); 1581 LDSubfile* ref = LDSpawn<LDSubfile>();
1582 ref->setColor (MainColor()); 1582 ref->setColor (MainColor());
1583 ref->setFileInfo (GetDocument (primName)); 1583 ref->setFileInfo (GetDocument (primName));
1584 ref->setPosition (Origin); 1584 ref->setPosition (Origin);
1585 ref->setTransform (IdentityMatrix); 1585 ref->setTransform (IdentityMatrix);
1586 LDDocument::current()->insertObj (g_win->getInsertionPoint(), ref); 1586 LDDocument::current()->insertObj (g_win->getInsertionPoint(), ref);

mercurial