Fem: Add property to set pipeline and filters color if Field is None - fixes #21352
This commit is contained in:
committed by
Chris Hennes
parent
2dcb495a67
commit
dbb6cbe335
@@ -2089,6 +2089,18 @@ void setupFilter(Gui::Command* cmd, std::string Name)
|
||||
auto objFilter = App::GetApplication().getActiveDocument()->getActiveObject();
|
||||
auto femFilter = static_cast<Fem::FemPostFilter*>(objFilter);
|
||||
|
||||
auto selObjectView = static_cast<FemGui::ViewProviderFemPostObject*>(
|
||||
Gui::Application::Instance->getViewProvider(selObject)
|
||||
);
|
||||
// use none field color from base filter
|
||||
Base::color_traits<Base::Color> ct {selObjectView->NoneFieldColor.getValue()};
|
||||
cmd->doCommand(
|
||||
Gui::Command::Doc,
|
||||
"App.activeDocument().ActiveObject.ViewObject.NoneFieldColor = (%d, %d, %d)",
|
||||
ct.red(),
|
||||
ct.green(),
|
||||
ct.blue()
|
||||
);
|
||||
// TODO: FIX
|
||||
/*
|
||||
auto selObjectView = static_cast<FemGui::ViewProviderFemPostObject*>(
|
||||
|
||||
@@ -166,6 +166,13 @@ ViewProviderFemPostObject::ViewProviderFemPostObject()
|
||||
App::Prop_None,
|
||||
"Set wireframe line color."
|
||||
);
|
||||
ADD_PROPERTY_TYPE(
|
||||
NoneFieldColor,
|
||||
(0.8f, 0.8f, 0.8f),
|
||||
"Object Style",
|
||||
App::Prop_None,
|
||||
"Shape color used if Field property is None."
|
||||
);
|
||||
ADD_PROPERTY_TYPE(
|
||||
PlainColorEdgeOnSurface,
|
||||
(false),
|
||||
@@ -689,7 +696,8 @@ void ViewProviderFemPostObject::WriteColorData(bool ResetColorBarRange)
|
||||
}
|
||||
|
||||
if (Field.getEnumVector().empty() || Field.getValue() == 0) {
|
||||
m_material->diffuseColor.setValue(SbColor(0.8, 0.8, 0.8));
|
||||
Base::Color cNone = NoneFieldColor.getValue();
|
||||
m_material->diffuseColor.setValue(SbColor(cNone.r, cNone.g, cNone.b));
|
||||
float trans = Base::fromPercent(Transparency.getValue());
|
||||
m_material->transparency.setValue(trans);
|
||||
m_materialBinding->value = SoMaterialBinding::OVERALL;
|
||||
@@ -867,6 +875,9 @@ void ViewProviderFemPostObject::onChanged(const App::Property* prop)
|
||||
int child = plainColor ? 1 : 0;
|
||||
m_switchMatEdges->whichChild.setValue(child);
|
||||
}
|
||||
else if (prop == &NoneFieldColor) {
|
||||
WriteColorData(ResetColorBarRange);
|
||||
}
|
||||
|
||||
ViewProviderDocumentObject::onChanged(prop);
|
||||
}
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
App::PropertyPercent Transparency;
|
||||
App::PropertyBool PlainColorEdgeOnSurface;
|
||||
App::PropertyColor EdgeColor;
|
||||
App::PropertyColor NoneFieldColor;
|
||||
App::PropertyFloatConstraint LineWidth;
|
||||
App::PropertyFloatConstraint PointSize;
|
||||
|
||||
|
||||
@@ -406,6 +406,9 @@ class CommandManager:
|
||||
FreeCADGui.doCommand(
|
||||
'FreeCAD.ActiveDocument.ActiveObject.ViewObject.SelectionStyle = "BoundBox"'
|
||||
)
|
||||
FreeCADGui.doCommand(
|
||||
f"FreeCAD.ActiveDocument.ActiveObject.ViewObject.NoneFieldColor = {self.selobj.ViewObject.NoneFieldColor}"
|
||||
)
|
||||
|
||||
# hide selected filter
|
||||
FreeCADGui.doCommand(
|
||||
|
||||
Reference in New Issue
Block a user