Gui: Fix preview rendering issues

This commit is contained in:
Kacper Donat
2025-09-03 00:24:38 +02:00
committed by Benjamin Nauck
parent 87a4ce2e8d
commit 51e563040b
2 changed files with 5 additions and 16 deletions

View File

@@ -56,7 +56,8 @@ SoPreviewShape::SoPreviewShape()
SO_NODE_ADD_FIELD(lineWidth, (defaultLineWidth));
SO_NODE_ADD_FIELD(transform, (SbMatrix::identity()));
pcTransform = new SoTransform;
pcTransform = new SoMatrixTransform;
pcTransform->matrix.connectFrom(&transform);
auto pickStyle = new SoPickStyle;
pickStyle->style = SoPickStyle::UNPICKABLE;
@@ -124,14 +125,6 @@ void SoPreviewShape::initClass()
SO_NODE_INIT_CLASS(SoPreviewShape, SoSeparator, "Separator");
}
void SoPreviewShape::notify(SoNotList* nl)
{
SoField* field = nl->getLastField();
if (field == &transform) {
pcTransform->setMatrix(transform.getValue());
}
}
EXTENSION_PROPERTY_SOURCE(PartGui::ViewProviderPreviewExtension, Gui::ViewProviderExtension)
ViewProviderPreviewExtension::ViewProviderPreviewExtension()

View File

@@ -32,18 +32,16 @@
#include <QtCore>
#include <Inventor/nodes/SoSubNode.h>
#include <Inventor/nodes/SoCoordinate3.h>
#include <Inventor/nodes/SoNormal.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/nodes/SoMatrixTransform.h>
#include <Inventor/fields/SoSFColor.h>
#include <Inventor/fields/SoSFFloat.h>
#include <Inventor/fields/SoSFMatrix.h>
#include <App/PropertyStandard.h>
#include <Gui/ViewProvider.h>
#include <Gui/ViewProviderExtension.h>
#include <Gui/ViewProviderExtensionPython.h>
#include <Inventor/fields/SoSFMatrix.h>
#include <Mod/Part/App/TopoShape.h>
namespace PartGui {
@@ -60,15 +58,13 @@ public:
SoPreviewShape();
static void initClass();
void notify(SoNotList* nl) override;
SoSFColor color;
SoSFFloat transparency;
SoSFFloat lineWidth;
SoSFMatrix transform;
private:
SoTransform* pcTransform;
SoMatrixTransform* pcTransform;
};
class PartGuiExport ViewProviderPreviewExtension : public Gui::ViewProviderExtension {