Assembly: Plane ViewProvider Size property and smaller standard size
This commit is contained in:
parent
51b46e1e37
commit
271bb65cbd
|
@ -64,13 +64,15 @@ PROPERTY_SOURCE(Gui::ViewProviderPlane, Gui::ViewProviderGeometryObject)
|
|||
|
||||
ViewProviderPlane::ViewProviderPlane()
|
||||
{
|
||||
|
||||
ADD_PROPERTY(Size,(1.0));
|
||||
|
||||
pMat = new SoMaterial();
|
||||
pMat->ref();
|
||||
|
||||
const float size = 10; // Note: If you change this, you need to also adapt App/Plane.cpp getBoundBox()
|
||||
float size = Size.getValue(); // Note: If you change this, you need to also adapt App/Plane.cpp getBoundBox()
|
||||
|
||||
static const SbVec3f verts[4] =
|
||||
SbVec3f verts[4] =
|
||||
{
|
||||
SbVec3f(size,size,0), SbVec3f(size,-size,0),
|
||||
SbVec3f(-size,-size,0), SbVec3f(-size,size,0),
|
||||
|
@ -106,7 +108,19 @@ ViewProviderPlane::~ViewProviderPlane()
|
|||
|
||||
void ViewProviderPlane::onChanged(const App::Property* prop)
|
||||
{
|
||||
ViewProviderGeometryObject::onChanged(prop);
|
||||
if (prop == &Size){
|
||||
float size = Size.getValue(); // Note: If you change this, you need to also adapt App/Plane.cpp getBoundBox()
|
||||
|
||||
SbVec3f verts[4] =
|
||||
{
|
||||
SbVec3f(size,size,0), SbVec3f(size,-size,0),
|
||||
SbVec3f(-size,-size,0), SbVec3f(-size,size,0),
|
||||
};
|
||||
|
||||
pCoords->point.setValues(0, 4, verts);
|
||||
}
|
||||
else
|
||||
ViewProviderGeometryObject::onChanged(prop);
|
||||
}
|
||||
|
||||
std::vector<std::string> ViewProviderPlane::getDisplayModes(void) const
|
||||
|
|
|
@ -49,6 +49,8 @@ public:
|
|||
ViewProviderPlane(void);
|
||||
virtual ~ViewProviderPlane();
|
||||
|
||||
App::PropertyFloat Size;
|
||||
|
||||
void attach(App::DocumentObject *);
|
||||
void updateData(const App::Property*);
|
||||
std::vector<std::string> getDisplayModes(void) const;
|
||||
|
|
Loading…
Reference in New Issue
Block a user