App/Gui: add new ObjectStatus TouchOnColorChange

For triggering recompute on color changes
This commit is contained in:
Zheng, Lei
2021-10-18 17:03:14 +08:00
committed by Chris Hennes
parent 611e79af53
commit c37c8658c4
3 changed files with 10 additions and 0 deletions

View File

@@ -65,6 +65,7 @@ enum ObjectStatus {
NoAutoExpand = 17, // disable tree item auto expand on selection for this object
PendingTransactionUpdate = 18, // mark that the object expects a call to onUndoRedoFinished() after transaction is finished.
RecomputeExtension = 19, // mark the object to recompute its extensions
TouchOnColorChange = 20, // inform view provider touch object on color change
};
/** Return object for feature execution

View File

@@ -157,6 +157,8 @@ void ViewProviderGeometryObject::onChanged(const App::Property* prop)
}
}
else if (prop == &ShapeMaterial) {
if (getObject() && getObject()->testStatus(App::ObjectStatus::TouchOnColorChange))
getObject()->touch(true);
const App::Material& Mat = ShapeMaterial.getValue();
long value = (long)(100*Mat.transparency);
if (value != Transparency.getValue())

View File

@@ -624,6 +624,9 @@ std::vector<Base::Vector3d> ViewProviderPartExt::getSelectionShape(const char* /
void ViewProviderPartExt::setHighlightedFaces(const std::vector<App::Color>& colors)
{
if (getObject() && getObject()->testStatus(App::ObjectStatus::TouchOnColorChange))
getObject()->touch(true);
Gui::SoUpdateVBOAction action;
action.apply(this->faceset);
@@ -779,6 +782,8 @@ void ViewProviderPartExt::unsetHighlightedFaces()
void ViewProviderPartExt::setHighlightedEdges(const std::vector<App::Color>& colors)
{
if (getObject() && getObject()->testStatus(App::ObjectStatus::TouchOnColorChange))
getObject()->touch(true);
int size = static_cast<int>(colors.size());
if (size > 1) {
// Although indexed lineset is used the material binding must be PER_FACE!
@@ -814,6 +819,8 @@ void ViewProviderPartExt::unsetHighlightedEdges()
void ViewProviderPartExt::setHighlightedPoints(const std::vector<App::Color>& colors)
{
if (getObject() && getObject()->testStatus(App::ObjectStatus::TouchOnColorChange))
getObject()->touch(true);
int size = static_cast<int>(colors.size());
if (size > 1) {
#if 0