Skip to content

Commit 251c813

Browse files
committed
Fem: Remove unused view properties
1 parent 95e7545 commit 251c813

File tree

2 files changed

+22
-47
lines changed

2 files changed

+22
-47
lines changed

src/Mod/Fem/Gui/ViewProviderFemConstraint.cpp

+19-36
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,15 @@
2424
#include "PreCompiled.h"
2525

2626
#ifndef _PreComp_
27-
#include <Inventor/nodes/SoBaseColor.h>
27+
#include <Inventor/nodes/SoMaterial.h>
2828
#include <Inventor/nodes/SoCone.h>
2929
#include <Inventor/nodes/SoCube.h>
3030
#include <Inventor/nodes/SoCylinder.h>
31-
#include <Inventor/nodes/SoFontStyle.h>
3231
#include <Inventor/nodes/SoMultipleCopy.h>
32+
#include <Inventor/nodes/SoPickStyle.h>
3333
#include <Inventor/nodes/SoRotation.h>
3434
#include <Inventor/nodes/SoSeparator.h>
3535
#include <Inventor/nodes/SoShapeHints.h>
36-
#include <Inventor/nodes/SoText2.h>
3736
#include <Inventor/nodes/SoTranslation.h>
3837
#include <QAction>
3938
#include <QDockWidget>
@@ -67,39 +66,22 @@ ViewProviderFemConstraint::ViewProviderFemConstraint()
6766
, wizardSubLayout(nullptr)
6867
, constraintDialog(nullptr)
6968
{
70-
ADD_PROPERTY(TextColor, (0.0f, 0.0f, 0.0f));
7169
ADD_PROPERTY(FaceColor, (1.0f, 0.0f, 0.2f));
72-
ADD_PROPERTY(FontSize, (18));
73-
ADD_PROPERTY(DistFactor, (1.0));
74-
ADD_PROPERTY(Mirror, (false));
75-
76-
pFont = new SoFontStyle();
77-
pFont->ref();
78-
pLabel = new SoText2();
79-
pLabel->ref();
80-
pTextColor = new SoBaseColor();
81-
pTextColor->ref();
70+
8271
pShapeSep = new SoSeparator();
8372
pShapeSep->ref();
8473
pMultCopy = new SoMultipleCopy();
8574
pMultCopy->ref();
86-
87-
pMaterials = new SoBaseColor();
75+
pMaterials = new SoMaterial();
8876
pMaterials->ref();
89-
pMaterials->rgb.setValue(1.0f, 0.0f, 0.2f);
77+
pMaterials->diffuseColor.setValue(1.0f, 0.0f, 0.2f);
9078

91-
TextColor.touch();
92-
FontSize.touch();
93-
FaceColor.touch();
9479

9580
Gui::ViewProviderSuppressibleExtension::initExtension(this);
9681
}
9782

9883
ViewProviderFemConstraint::~ViewProviderFemConstraint()
9984
{
100-
pFont->unref();
101-
pLabel->unref();
102-
pTextColor->unref();
10385
pMaterials->unref();
10486
pMultCopy->unref();
10587
pShapeSep->unref();
@@ -182,20 +164,21 @@ void ViewProviderFemConstraint::setupContextMenu(QMenu* menu, QObject* receiver,
182164

183165
void ViewProviderFemConstraint::onChanged(const App::Property* prop)
184166
{
185-
if (prop == &Mirror) {
186-
updateData(prop);
187-
}
188-
else if (prop == &TextColor) {
189-
const App::Color& c = TextColor.getValue();
190-
pTextColor->rgb.setValue(c.r, c.g, c.b);
191-
}
192-
else if (prop == &FaceColor) {
193-
const App::Color& c = FaceColor.getValue();
194-
pMaterials->rgb.setValue(c.r, c.g, c.b);
195-
}
196-
else if (prop == &FontSize) {
197-
pFont->size = FontSize.getValue();
167+
if (prop == &ShapeAppearance) {
168+
const App::Color& d = ShapeAppearance.getDiffuseColor();
169+
pMaterials->diffuseColor.setValue(d.r, d.g, d.b);
170+
const App::Color& s = ShapeAppearance.getSpecularColor();
171+
pMaterials->specularColor.setValue(s.r, s.g, s.b);
172+
const App::Color& e = ShapeAppearance.getEmissiveColor();
173+
pMaterials->emissiveColor.setValue(e.r, e.g, e.b);
174+
const App::Color& a = ShapeAppearance.getAmbientColor();
175+
pMaterials->ambientColor.setValue(a.r, a.g, a.b);
176+
pMaterials->shininess.setValue(ShapeAppearance.getShininess() / 100.0f);
177+
pMaterials->transparency.setValue(ShapeAppearance.getTransparency() / 100.0f);
198178
}
179+
// else if (prop == &Transparency) {
180+
// pMaterials->transparency.setValue(Transparency.getValue() / 100.0f);
181+
// }
199182
else {
200183
ViewProviderDocumentObject::onChanged(prop); // clazy:exclude=skipped-base-method
201184
}

src/Mod/Fem/Gui/ViewProviderFemConstraint.h

+3-11
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@
3535

3636

3737
class SbRotation;
38-
class SoFontStyle;
39-
class SoText2;
4038
class SoBaseColor;
41-
class SoMaterial;
39+
class SMaterial;
4240
class SoMultipleCopy;
4341

4442
namespace FemGui
@@ -57,11 +55,7 @@ class FemGuiExport ViewProviderFemConstraint: public Gui::ViewProviderGeometryOb
5755
~ViewProviderFemConstraint() override;
5856

5957
// Display properties
60-
App::PropertyColor TextColor;
6158
App::PropertyColor FaceColor;
62-
App::PropertyInteger FontSize;
63-
App::PropertyFloat DistFactor;
64-
App::PropertyBool Mirror;
6559

6660
void attach(App::DocumentObject*) override;
6761
void updateData(const App::Property* prop) override;
@@ -165,10 +159,8 @@ class FemGuiExport ViewProviderFemConstraint: public Gui::ViewProviderGeometryOb
165159
const bool gap = false);
166160

167161
private:
168-
SoFontStyle* pFont;
169-
SoText2* pLabel;
170-
SoBaseColor* pTextColor;
171-
SoBaseColor* pMaterials;
162+
// SoBaseColor* pMaterials;
163+
SoMaterial* pMaterials;
172164
bool rotateSymbol;
173165

174166
protected:

0 commit comments

Comments
 (0)