Miscellaneous fixes

This commit is contained in:
jrheinlaender
2013-05-15 19:13:21 +04:30
committed by Stefan Tröger
parent 1f42d4e3a3
commit 4645fdcd37
9 changed files with 64 additions and 29 deletions

View File

@@ -47,6 +47,10 @@ using namespace Gui;
bool ReferenceSelection::allow(App::Document* pDoc, App::DocumentObject* pObj, const char* sSubName)
{
// Don't allow selection in other document
if ((support != NULL) && (pDoc != support->getDocument()))
return false;
if (plane && (pObj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId())))
// Note: It is assumed that a Part has exactly 3 App::Plane objects at the root of the feature tree
return true;
@@ -68,10 +72,7 @@ bool ReferenceSelection::allow(App::Document* pDoc, App::DocumentObject* pObj, c
// Handle selection of geometry elements
if (support == NULL)
return false;
// Don't allow selection in other document
if (pDoc != support->getDocument())
return false;
return false;
if (!sSubName || sSubName[0] == '\0')
return false;
if (pObj != support)

View File

@@ -334,7 +334,7 @@ int TaskPadParameters::getMode(void) const
QByteArray TaskPadParameters::getFaceName(void) const
{
if ((getMode() >= 1) || (getMode() <= 3))
if ((getMode() >= 1) && (getMode() <= 3))
return getFaceReference(ui->lineFaceName->text(), ui->lineFaceName->property("FaceName").toString()).toLatin1();
else
return "";

View File

@@ -314,7 +314,7 @@ int TaskPocketParameters::getMode(void) const
QByteArray TaskPocketParameters::getFaceName(void) const
{
if ((getMode() >= 1) || (getMode() <= 3))
if ((getMode() >= 1) && (getMode() <= 3))
return getFaceReference(ui->lineFaceName->text(), ui->lineFaceName->property("FaceName").toString()).toLatin1();
else
return "";

View File

@@ -91,8 +91,7 @@ const QString TaskSketchBasedParameters::onAddSelection(const Gui::SelectionChan
QString refStr;
// Remove subname for planes and datum features
if (selObj->getTypeId().isDerivedFrom(App::Plane::getClassTypeId()) ||
selObj->getTypeId().isDerivedFrom(Part::Datum::getClassTypeId())) {
if (PartDesign::Feature::isDatum(selObj)) {
subname = "";
refStr = QString::fromAscii(selObj->getNameInDocument());
} else {

View File

@@ -32,6 +32,8 @@
# include <Inventor/nodes/SoShapeHints.h>
# include <Inventor/nodes/SoMaterial.h>
# include <Inventor/nodes/SoBaseColor.h>
# include <Inventor/nodes/SoTransparencyType.h>
# include <Inventor/nodes/SoDrawStyle.h>
# include <Inventor/nodes/SoMarkerSet.h>
# include <Inventor/nodes/SoVertexProperty.h>
# include <Inventor/nodes/SoLineSet.h>
@@ -90,15 +92,27 @@ void ViewProviderDatum::attach(App::DocumentObject *obj)
else if (o->getTypeId() == PartDesign::Point::getClassTypeId())
datumType = QObject::tr("Point");
SoSeparator* sep = new SoSeparator();
SoPickStyle* ps = new SoPickStyle();
ps->style = SoPickStyle::SHAPE;
SoShapeHints* hints = new SoShapeHints();
hints->shapeType.setValue(SoShapeHints::UNKNOWN_SHAPE_TYPE);
hints->vertexOrdering.setValue(SoShapeHints::COUNTERCLOCKWISE);
SoMaterialBinding* bind = new SoMaterialBinding();
SoTransparencyType* ttype = new SoTransparencyType();
ttype->value.setValue(SoGLRenderAction::BLEND);
SoDrawStyle* fstyle = new SoDrawStyle();
fstyle->style = SoDrawStyle::FILLED;
SoNormalBinding* normb = new SoNormalBinding();
normb->value = SoNormalBinding::PER_VERTEX_INDEXED;
SoBaseColor* color = new SoBaseColor();
color->rgb.setValue(0.9, 0.9, 0.3);
SoSeparator* sep = new SoSeparator();
SoPickStyle* ps = new SoPickStyle();
ps->style = SoPickStyle::SHAPE;
sep->addChild(hints);
sep->addChild(bind);
sep->addChild(ttype);
sep->addChild(fstyle);
sep->addChild(normb);
sep->addChild(color);
sep->addChild(ps);
sep->addChild(pShapeSep);