Extended the DrawStryle property to all Part-based objects
ViewProvider of Part objects now have a DrawStyle property that allow them to display with solid, dashed, dotted or dashdotted linestyles.
This commit is contained in:
parent
68c9d5e0fb
commit
54da404dbd
|
@ -1510,8 +1510,6 @@ class _ViewProviderDraft:
|
|||
return mode
|
||||
|
||||
def onChanged(self, vp, prop):
|
||||
if prop == "DrawStyle":
|
||||
self.setStyle(vp)
|
||||
return
|
||||
|
||||
def setStyle(self,vobj):
|
||||
|
@ -2116,8 +2114,6 @@ class _ViewProviderRectangle(_ViewProviderDraft):
|
|||
if self.texture:
|
||||
r.removeChild(self.texture)
|
||||
self.texture = None
|
||||
elif prop == "DrawStyle":
|
||||
self.setStyle(vp)
|
||||
return
|
||||
|
||||
class _Circle:
|
||||
|
@ -2284,8 +2280,6 @@ class _ViewProviderWire(_ViewProviderDraft):
|
|||
rn.addChild(self.pt)
|
||||
else:
|
||||
rn.removeChild(self.pt)
|
||||
elif prop == "DrawStyle":
|
||||
self.setStyle(vp)
|
||||
return
|
||||
|
||||
def claimChildren(self):
|
||||
|
@ -2446,8 +2440,6 @@ class _ViewProviderBSpline(_ViewProviderDraft):
|
|||
rn.addChild(self.pt)
|
||||
else:
|
||||
rn.removeChild(self.pt)
|
||||
elif prop == "DrawStyle":
|
||||
self.setStyle(vp)
|
||||
return
|
||||
|
||||
class _Block:
|
||||
|
|
|
@ -119,6 +119,7 @@ PROPERTY_SOURCE(PartGui::ViewProviderPartExt, Gui::ViewProviderGeometryObject)
|
|||
App::PropertyFloatConstraint::Constraints ViewProviderPartExt::sizeRange = {1.0f,64.0f,1.0f};
|
||||
App::PropertyFloatConstraint::Constraints ViewProviderPartExt::tessRange = {0.0001f,100.0f,0.01f};
|
||||
const char* ViewProviderPartExt::LightingEnums[]= {"One side","Two side",NULL};
|
||||
const char* ViewProviderPartExt::DrawStyleEnums[]= {"Solid","Dashed","Dotted","Dashdot",NULL};
|
||||
|
||||
ViewProviderPartExt::ViewProviderPartExt()
|
||||
{
|
||||
|
@ -145,6 +146,8 @@ ViewProviderPartExt::ViewProviderPartExt()
|
|||
ADD_PROPERTY(ControlPoints,(false));
|
||||
ADD_PROPERTY(Lighting,(1));
|
||||
Lighting.setEnums(LightingEnums);
|
||||
ADD_PROPERTY(DrawStyle,((long int)0));
|
||||
DrawStyle.setEnums(DrawStyleEnums);
|
||||
|
||||
coords = new SoCoordinate3();
|
||||
coords->ref();
|
||||
|
@ -185,6 +188,7 @@ ViewProviderPartExt::ViewProviderPartExt()
|
|||
pShapeHints->shapeType = SoShapeHints::UNKNOWN_SHAPE_TYPE;
|
||||
pShapeHints->ref();
|
||||
Lighting.touch();
|
||||
DrawStyle.touch();
|
||||
|
||||
sPixmap = "Tree_Part";
|
||||
loadParameter();
|
||||
|
@ -278,6 +282,16 @@ void ViewProviderPartExt::onChanged(const App::Property* prop)
|
|||
else
|
||||
pShapeHints->vertexOrdering = SoShapeHints::COUNTERCLOCKWISE;
|
||||
}
|
||||
else if (prop == &DrawStyle) {
|
||||
if (DrawStyle.getValue() == 0)
|
||||
pcLineStyle->linePattern = 0xffff;
|
||||
else if (DrawStyle.getValue() == 1)
|
||||
pcLineStyle->linePattern = 0xf00f;
|
||||
else if (DrawStyle.getValue() == 2)
|
||||
pcLineStyle->linePattern = 0x0f0f;
|
||||
else
|
||||
pcLineStyle->linePattern = 0xff88;
|
||||
}
|
||||
else {
|
||||
// if the object was invisible and has been changed, recreate the visual
|
||||
if (prop == &Visibility && Visibility.getValue() && VisualTouched)
|
||||
|
|
|
@ -77,6 +77,7 @@ public:
|
|||
App::PropertyMaterial PointMaterial;
|
||||
App::PropertyBool ControlPoints;
|
||||
App::PropertyEnumeration Lighting;
|
||||
App::PropertyEnumeration DrawStyle;
|
||||
|
||||
App::PropertyColorList DiffuseColor;
|
||||
|
||||
|
@ -144,6 +145,7 @@ private:
|
|||
static App::PropertyFloatConstraint::Constraints sizeRange;
|
||||
static App::PropertyFloatConstraint::Constraints tessRange;
|
||||
static const char* LightingEnums[];
|
||||
static const char* DrawStyleEnums[];
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user