|
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,22 @@ ViewProviderFemConstraint::ViewProviderFemConstraint()
|
67 | 66 | , wizardSubLayout(nullptr)
|
68 | 67 | , constraintDialog(nullptr)
|
69 | 68 | {
|
70 |
| - ADD_PROPERTY(TextColor, (0.0f, 0.0f, 0.0f)); |
71 | 69 | 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 | + |
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); |
| 77 | + pMaterials->diffuseColor.setValue(1.0f, 0.0f, 0.2f); |
90 | 78 |
|
91 |
| - TextColor.touch(); |
92 |
| - FontSize.touch(); |
93 |
| - FaceColor.touch(); |
94 | 79 |
|
95 | 80 | Gui::ViewProviderSuppressibleExtension::initExtension(this);
|
96 | 81 | }
|
97 | 82 |
|
98 | 83 | ViewProviderFemConstraint::~ViewProviderFemConstraint()
|
99 | 84 | {
|
100 |
| - pFont->unref(); |
101 |
| - pLabel->unref(); |
102 |
| - pTextColor->unref(); |
103 | 85 | pMaterials->unref();
|
104 | 86 | pMultCopy->unref();
|
105 | 87 | pShapeSep->unref();
|
@@ -182,20 +164,21 @@ void ViewProviderFemConstraint::setupContextMenu(QMenu* menu, QObject* receiver,
|
182 | 164 |
|
183 | 165 | void ViewProviderFemConstraint::onChanged(const App::Property* prop)
|
184 | 166 | {
|
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); |
198 | 178 | }
|
| 179 | + // else if (prop == &Transparency) { |
| 180 | + // pMaterials->transparency.setValue(Transparency.getValue() / 100.0f); |
| 181 | + // } |
199 | 182 | else {
|
200 | 183 | ViewProviderDocumentObject::onChanged(prop); // clazy:exclude=skipped-base-method
|
201 | 184 | }
|
|
0 commit comments