Description
QGLAbstractScene::generatePickNodes() generates pick identifiers starting at zero, adding new ids from nextPickId() onwards every time it is called. Because every QGLAbstractScene object starts at zero, it won't be possible to distinguish pickable objects that were loaded from two separate 3DS files (each with their own QGLAbstractScene), but displayed in the same QGLView. Some way is needed for the caller to offset the starting pick identifier when generatePickNodes() is called. Suggest something like:
int generatePickNodes(int startId = 0);
The caller supplies the starting identifier, and the function returns the highest allocated id plus 1. The return value can then be provided to the next QGLAbstractScene object to allocate disjoint identifiers.
It should also be possible to do away with nextPickId(), simplifying the API in the process. Just have generatePickNodes() do this:
QGLPickNode *pn = new QGLPickNode(); pn->setId(startId++);
I'm also not sure what purpose pickable/setPickable are serving. Presumably if the user calls generatePickNodes(), then the need for picking is implicit. If they don't call it, none of the nodes will have pick ids, so picking will be disabled during painting anyway. Perhaps the API can be simplified all the way down to just generatePickNodes()?
Attachments
Issue Links
- is replaced by
-
QTBUG-16320 When using common geometry for large scene efficiency, only the base geometry is selected for picking
- Closed
- relates to
-
QTBUG-19535 QGLSceneNode::draw should execute painter.setPickObjectId with / without having geometry
- Closed