|
24 | 24 | #include "PreCompiled.h"
|
25 | 25 |
|
26 | 26 | #ifndef _PreComp_
|
27 |
| -#include <Inventor/nodes/SoBaseColor.h> |
| 27 | +#include <Inventor/nodes/SoMaterial.h> |
28 | 28 | #include <Inventor/nodes/SoCone.h>
|
29 | 29 | #include <Inventor/nodes/SoCube.h>
|
30 | 30 | #include <Inventor/nodes/SoCylinder.h>
|
31 |
| -#include <Inventor/nodes/SoFontStyle.h> |
32 | 31 | #include <Inventor/nodes/SoMultipleCopy.h>
|
| 32 | +#include <Inventor/nodes/SoPickStyle.h> |
33 | 33 | #include <Inventor/nodes/SoRotation.h>
|
34 | 34 | #include <Inventor/nodes/SoSeparator.h>
|
35 | 35 | #include <Inventor/nodes/SoShapeHints.h>
|
36 |
| -#include <Inventor/nodes/SoText2.h> |
37 | 36 | #include <Inventor/nodes/SoTranslation.h>
|
38 | 37 | #include <QAction>
|
39 | 38 | #include <QDockWidget>
|
@@ -67,39 +66,23 @@ ViewProviderFemConstraint::ViewProviderFemConstraint()
|
67 | 66 | , wizardSubLayout(nullptr)
|
68 | 67 | , constraintDialog(nullptr)
|
69 | 68 | {
|
70 |
| - ADD_PROPERTY(TextColor, (0.0f, 0.0f, 0.0f)); |
71 |
| - 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(); |
| 69 | + Transparency.setStatus(App::Property::Hidden, true); |
| 70 | + |
82 | 71 | pShapeSep = new SoSeparator();
|
83 | 72 | pShapeSep->ref();
|
84 | 73 | pMultCopy = new SoMultipleCopy();
|
85 | 74 | pMultCopy->ref();
|
86 |
| - |
87 |
| - pMaterials = new SoBaseColor(); |
| 75 | + pMaterials = new SoMaterial(); |
88 | 76 | pMaterials->ref();
|
89 |
| - pMaterials->rgb.setValue(1.0f, 0.0f, 0.2f); |
90 | 77 |
|
91 |
| - TextColor.touch(); |
92 |
| - FontSize.touch(); |
93 |
| - FaceColor.touch(); |
| 78 | + ShapeAppearance.setDiffuseColor(1.0f, 0.0f, 0.2f); |
| 79 | + ShapeAppearance.setSpecularColor(0.0f, 0.0f, 0.0f); |
94 | 80 |
|
95 | 81 | Gui::ViewProviderSuppressibleExtension::initExtension(this);
|
96 | 82 | }
|
97 | 83 |
|
98 | 84 | ViewProviderFemConstraint::~ViewProviderFemConstraint()
|
99 | 85 | {
|
100 |
| - pFont->unref(); |
101 |
| - pLabel->unref(); |
102 |
| - pTextColor->unref(); |
103 | 86 | pMaterials->unref();
|
104 | 87 | pMultCopy->unref();
|
105 | 88 | pShapeSep->unref();
|
@@ -191,19 +174,17 @@ void ViewProviderFemConstraint::setupContextMenu(QMenu* menu, QObject* receiver,
|
191 | 174 |
|
192 | 175 | void ViewProviderFemConstraint::onChanged(const App::Property* prop)
|
193 | 176 | {
|
194 |
| - if (prop == &Mirror) { |
195 |
| - updateData(prop); |
196 |
| - } |
197 |
| - else if (prop == &TextColor) { |
198 |
| - const App::Color& c = TextColor.getValue(); |
199 |
| - pTextColor->rgb.setValue(c.r, c.g, c.b); |
200 |
| - } |
201 |
| - else if (prop == &FaceColor) { |
202 |
| - const App::Color& c = FaceColor.getValue(); |
203 |
| - pMaterials->rgb.setValue(c.r, c.g, c.b); |
204 |
| - } |
205 |
| - else if (prop == &FontSize) { |
206 |
| - pFont->size = FontSize.getValue(); |
| 177 | + if (prop == &ShapeAppearance) { |
| 178 | + const App::Color& d = ShapeAppearance.getDiffuseColor(); |
| 179 | + pMaterials->diffuseColor.setValue(d.r, d.g, d.b); |
| 180 | + const App::Color& s = ShapeAppearance.getSpecularColor(); |
| 181 | + pMaterials->specularColor.setValue(s.r, s.g, s.b); |
| 182 | + const App::Color& e = ShapeAppearance.getEmissiveColor(); |
| 183 | + pMaterials->emissiveColor.setValue(e.r, e.g, e.b); |
| 184 | + const App::Color& a = ShapeAppearance.getAmbientColor(); |
| 185 | + pMaterials->ambientColor.setValue(a.r, a.g, a.b); |
| 186 | + pMaterials->shininess.setValue(ShapeAppearance.getShininess()); |
| 187 | + pMaterials->transparency.setValue(ShapeAppearance.getTransparency()); |
207 | 188 | }
|
208 | 189 | else {
|
209 | 190 | ViewProviderDocumentObject::onChanged(prop); // clazy:exclude=skipped-base-method
|
|
0 commit comments