PD: Make datum points highlightable/selectable (#12439)
* PD: Make datum points highlightable/selectable Give the user some feedback by changing the color of the datum point marker as the user selects or hovers over it. Closes #9540
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#ifndef _PreComp_
|
||||
# include <Inventor/nodes/SoCoordinate3.h>
|
||||
# include <Inventor/nodes/SoSeparator.h>
|
||||
# include <Inventor/nodes/SoMarkerSet.h>
|
||||
# include <Inventor/nodes/SoVertexProperty.h>
|
||||
@@ -32,6 +33,8 @@
|
||||
|
||||
#include <App/Application.h>
|
||||
#include <Gui/Inventor/MarkerBitmaps.h>
|
||||
#include <Gui/ViewProviderBuilder.h>
|
||||
#include <Gui/SoFCSelection.h>
|
||||
#include <Mod/PartDesign/App/DatumPoint.h>
|
||||
|
||||
#include "ViewProviderDatumPoint.h"
|
||||
@@ -54,21 +57,20 @@ ViewProviderDatumPoint::~ViewProviderDatumPoint() = default;
|
||||
void ViewProviderDatumPoint::attach ( App::DocumentObject *obj ) {
|
||||
ViewProviderDatum::attach ( obj );
|
||||
|
||||
SoMFVec3f v;
|
||||
v.setNum(1);
|
||||
v.set1Value(0, 0,0,0);
|
||||
|
||||
SoVertexProperty* vprop = new SoVertexProperty();
|
||||
vprop->vertex = v;
|
||||
|
||||
// Using a marker gives a larger point but it doesn't do highlighting automatically like the SoBrepPointSet
|
||||
// TODO Fix the highlight (may be via additional pcHighlight node?) (2015-09-09, Fat-Zer)
|
||||
SoMarkerSet* marker = new SoMarkerSet();
|
||||
marker->vertexProperty = vprop;
|
||||
const int markerSize = App::GetApplication().GetParameterGroupByPath(
|
||||
"User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 9);
|
||||
// Using a marker gives a larger point.
|
||||
auto *marker = new SoMarkerSet();
|
||||
marker->numPoints = 1;
|
||||
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex("DIAMOND_FILLED", App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View")->GetInt("MarkerSize", 9));
|
||||
marker->markerIndex = Gui::Inventor::MarkerBitmaps::getMarkerIndex("DIAMOND_FILLED",
|
||||
markerSize);
|
||||
|
||||
getShapeRoot ()->addChild(marker);
|
||||
auto *pcHighlight = Gui::ViewProviderBuilder::createSelection();
|
||||
pcHighlight->style = Gui::SoFCSelection::EMISSIVE_DIFFUSE;
|
||||
pcHighlight->addChild(new SoCoordinate3());
|
||||
pcHighlight->addChild(marker);
|
||||
|
||||
getShapeRoot ()->addChild(pcHighlight);
|
||||
}
|
||||
|
||||
void ViewProviderDatumPoint::onChanged (const App::Property* prop) {
|
||||
|
||||
Reference in New Issue
Block a user