Gui: refactor bounding box selection style
Previously, box style selection is rendered using customized SoBoxSelectionRenderAction, which does not support selection context, i.e. it does not work with Link. This patch implements context aware bound box rendering inside SoFCSelectionRoot, SoFCSelection and SoFCPathAnnotation (for always on top rendering). The box rendering in SoBoxSelectionRenderAction is disabled on construction. Box style selection can be enabled for individual object through property SelectionStyle (moved from ViewProviderGeometryObject to ViewProviderDocumentObject), or globally through Parameter BaseApp/Preferences/View/ShowSelectionBoundingBox. In addition, the parameter BaseApp/Preferences/View/UseNewSelection is used to override selection model reported from ViewProvider::useNewSelectionModel(). The reason being that, the same parameter is already used to toggle selection model inside SoFCSelection. This avoids inconsistency of selection model choice between view provider and the SoFCSelection node inside. Note that if the parameter 'UseNewSelection' is set to false, those view providers that choose old selection model will not work with Link.
This commit is contained in:
@@ -104,7 +104,15 @@ ViewProvider::ViewProvider()
|
||||
{
|
||||
setStatus(UpdateData, true);
|
||||
|
||||
pcRoot = new SoFCSeparator;
|
||||
|
||||
// SoFCSeparater and SoFCSelectionRoot can both track render cache setting.
|
||||
// We change to SoFCSelectionRoot so that we can dynamically change full
|
||||
// selection mode (full highlight vs. boundbox). Note that comparing to
|
||||
// SoFCSeparater, there are some small overhead with SoFCSelectionRoot for
|
||||
// selection context tracking.
|
||||
//
|
||||
// pcRoot = new SoFCSeparator(true);
|
||||
pcRoot = new SoFCSelectionRoot(true);
|
||||
pcRoot->ref();
|
||||
pcModeSwitch = new SoSwitch();
|
||||
pcModeSwitch->ref();
|
||||
|
||||
Reference in New Issue
Block a user