Link: Fix Selectable (#23567)
* Link: Fix Selectable * to squash * squash * squash
This commit is contained in:
@@ -912,8 +912,6 @@ std::vector< App::DocumentObject* > ViewProvider::claimChildren3D() const
|
||||
}
|
||||
|
||||
bool ViewProvider::getElementPicked(const SoPickedPoint *pp, std::string &subname) const {
|
||||
if(!isSelectable())
|
||||
return false;
|
||||
auto vector = getExtensionsDerivedFromType<Gui::ViewProviderExtension>();
|
||||
for(Gui::ViewProviderExtension* ext : vector) {
|
||||
if(ext->extensionGetElementPicked(pp,subname))
|
||||
@@ -1080,3 +1078,4 @@ void ViewProvider::setLinkVisible(bool visible) {
|
||||
if(ext)
|
||||
ext->setLinkVisible(visible);
|
||||
}
|
||||
|
||||
|
||||
@@ -591,8 +591,6 @@ bool ViewProviderDocumentObject::showInTree() const {
|
||||
|
||||
bool ViewProviderDocumentObject::getElementPicked(const SoPickedPoint *pp, std::string &subname) const
|
||||
{
|
||||
if(!isSelectable())
|
||||
return false;
|
||||
auto vector = getExtensionsDerivedFromType<Gui::ViewProviderExtension>();
|
||||
for(Gui::ViewProviderExtension* ext : vector)
|
||||
if(ext->extensionGetElementPicked(pp,subname))
|
||||
@@ -702,3 +700,4 @@ std::string ViewProviderDocumentObject::getFullName() const {
|
||||
return pcObject->getFullName() + ".ViewObject";
|
||||
return std::string("?");
|
||||
}
|
||||
|
||||
|
||||
@@ -402,6 +402,13 @@ public:
|
||||
|
||||
for(int i=0,count=root->getNumChildren();i<count;++i) {
|
||||
SoNode *node = root->getChild(i);
|
||||
|
||||
// Exclude the linked object's pick style from the snapshot,
|
||||
// so that the Link's own pick style is the only one in effect.
|
||||
if (node->isOfType(SoPickStyle::getClassTypeId())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if(node==pcLinked->getTransformNode()) {
|
||||
if(type!=LinkView::SnapshotTransform)
|
||||
pcSnapshot->addChild(node);
|
||||
@@ -502,7 +509,7 @@ public:
|
||||
bool getElementPicked(bool addname, int type,
|
||||
const SoPickedPoint *pp, std::ostream &str) const
|
||||
{
|
||||
if(!pp || !isLinked() || !pcLinked->isSelectable())
|
||||
if(!pp || !isLinked())
|
||||
return false;
|
||||
|
||||
if(addname)
|
||||
@@ -1670,10 +1677,14 @@ ViewProviderLink::ViewProviderLink()
|
||||
DisplayMode.setStatus(App::Property::Status::Hidden, true);
|
||||
|
||||
linkView = new LinkView;
|
||||
|
||||
pcPickStyle = new SoPickStyle;
|
||||
pcPickStyle->ref();
|
||||
}
|
||||
|
||||
ViewProviderLink::~ViewProviderLink()
|
||||
{
|
||||
pcPickStyle->unref();
|
||||
linkView->setInvalid();
|
||||
}
|
||||
|
||||
@@ -1681,7 +1692,12 @@ bool ViewProviderLink::isSelectable() const {
|
||||
return Selectable.getValue();
|
||||
}
|
||||
|
||||
void ViewProviderLink::attach(App::DocumentObject *pcObj) {
|
||||
void ViewProviderLink::attach(App::DocumentObject* pcObj)
|
||||
{
|
||||
if (pcRoot->findChild(pcPickStyle) < 0) {
|
||||
pcRoot->insertChild(pcPickStyle, 0);
|
||||
}
|
||||
|
||||
SoNode *node = linkView->getLinkRoot();
|
||||
node->setName(pcObj->getFullName().c_str());
|
||||
addDisplayMaskMode(node,"Link");
|
||||
@@ -1743,7 +1759,12 @@ QPixmap ViewProviderLink::getOverlayPixmap() const {
|
||||
return BitmapFactory().pixmapFromSvg("LinkOverlay", QSizeF(px,px));
|
||||
}
|
||||
|
||||
void ViewProviderLink::onChanged(const App::Property* prop) {
|
||||
void ViewProviderLink::onChanged(const App::Property* prop)
|
||||
{
|
||||
if (prop == &Selectable) {
|
||||
pcPickStyle->style = Selectable.getValue() ? SoPickStyle::SHAPE : SoPickStyle::UNPICKABLE;
|
||||
}
|
||||
|
||||
if(prop==&ChildViewProvider) {
|
||||
childVp = freecad_cast<ViewProviderDocumentObject*>(ChildViewProvider.getObject().get());
|
||||
if(childVp && getObject()) {
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
class SoBase;
|
||||
class SoDragger;
|
||||
class SoMaterialBinding;
|
||||
class SoPickStyle;
|
||||
|
||||
namespace Gui {
|
||||
|
||||
@@ -337,6 +338,9 @@ protected:
|
||||
ViewProviderDocumentObject *childVp;
|
||||
LinkInfoPtr childVpLink;
|
||||
mutable qint64 overlayCacheKey;
|
||||
|
||||
private:
|
||||
SoPickStyle* pcPickStyle {nullptr};
|
||||
};
|
||||
|
||||
using ViewProviderLinkPython = ViewProviderFeaturePythonT<ViewProviderLink>;
|
||||
|
||||
Reference in New Issue
Block a user