Gui: refactor gizmo attachment code
This commit is contained in:
committed by
Kacper Donat
parent
e21f616974
commit
6282b7c08d
@@ -326,7 +326,7 @@ void ThicknessWidget::setupGizmos()
|
||||
delete linearGizmo;
|
||||
return;
|
||||
}
|
||||
gizmoContainer = Gui::GizmoContainer::createGizmo({linearGizmo}, vp);
|
||||
gizmoContainer = Gui::GizmoContainer::create({linearGizmo}, vp);
|
||||
|
||||
setGizmoPositions();
|
||||
}
|
||||
|
||||
@@ -111,25 +111,6 @@ void ViewProviderPart::applyTransparency(float transparency, std::vector<App::Ma
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderPart::setEditViewer(Gui::View3DInventorViewer* viewer, int ModNum)
|
||||
{
|
||||
ViewProviderPartExt::setEditViewer(viewer, ModNum);
|
||||
|
||||
if (gizmoContainer) {
|
||||
gizmoContainer->setUpAutoScale(viewer->getSoRenderManager()->getCamera());
|
||||
|
||||
auto originPlacement = App::GeoFeature::getGlobalPlacement(getObject())
|
||||
* getObjectPlacement().inverse();
|
||||
gizmoContainer->attachViewer(viewer, originPlacement);
|
||||
}
|
||||
}
|
||||
|
||||
void ViewProviderPart::setGizmoContainer(Gui::GizmoContainer* gizmoContainer)
|
||||
{
|
||||
assert(gizmoContainer);
|
||||
this->gizmoContainer = gizmoContainer;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void ViewProviderShapeBuilder::buildNodes(const App::Property* prop, std::vector<SoNode*>& nodes) const
|
||||
|
||||
@@ -60,8 +60,6 @@ public:
|
||||
~ViewProviderPart() override;
|
||||
bool doubleClicked() override;
|
||||
|
||||
void setGizmoContainer(Gui::GizmoContainer* gizmoContainer);
|
||||
|
||||
protected:
|
||||
void applyColor(const Part::ShapeHistory& hist,
|
||||
const std::vector<Base::Color>& colBase,
|
||||
@@ -71,11 +69,6 @@ protected:
|
||||
std::vector<App::Material>& colBool);
|
||||
void applyTransparency(float transparency, std::vector<Base::Color>& colors);
|
||||
void applyTransparency(float transparency, std::vector<App::Material>& colors);
|
||||
|
||||
void setEditViewer(Gui::View3DInventorViewer* viewer, int ModNum) override;
|
||||
|
||||
private:
|
||||
Gui::GizmoContainer* gizmoContainer = nullptr;
|
||||
};
|
||||
|
||||
} // namespace PartGui
|
||||
|
||||
@@ -383,7 +383,7 @@ void TaskChamferParameters::setupGizmos(ViewProviderDressUp* vp)
|
||||
}
|
||||
});
|
||||
|
||||
gizmoContainer = GizmoContainer::createGizmo({
|
||||
gizmoContainer = GizmoContainer::create({
|
||||
distanceGizmo, secondDistanceGizmo, angleGizmo
|
||||
}, vp);
|
||||
|
||||
|
||||
@@ -1375,7 +1375,7 @@ void TaskExtrudeParameters::setupGizmos()
|
||||
setGizmoPositions();
|
||||
});
|
||||
|
||||
gizmoContainer = GizmoContainer::createGizmo({
|
||||
gizmoContainer = GizmoContainer::create({
|
||||
lengthGizmo1, lengthGizmo2,
|
||||
taperAngleGizmo1, taperAngleGizmo2
|
||||
}, vp);
|
||||
|
||||
@@ -216,7 +216,7 @@ void TaskFilletParameters::setupGizmos(ViewProviderDressUp* vp)
|
||||
radiusGizmo = new Gui::LinearGizmo(ui->filletRadius);
|
||||
radiusGizmo2 = new Gui::LinearGizmo(ui->filletRadius);
|
||||
|
||||
gizmoContainer = GizmoContainer::createGizmo({radiusGizmo, radiusGizmo2}, vp);
|
||||
gizmoContainer = GizmoContainer::create({radiusGizmo, radiusGizmo2}, vp);
|
||||
|
||||
setGizmoPositions();
|
||||
}
|
||||
|
||||
@@ -726,7 +726,7 @@ void TaskHelixParameters::setupGizmos(ViewProviderHelix* vp)
|
||||
heightGizmo->setVisibility(!isPitchTurnsAngle);
|
||||
});
|
||||
|
||||
gizmoContainer = GizmoContainer::createGizmo({heightGizmo}, vp);
|
||||
gizmoContainer = GizmoContainer::create({heightGizmo}, vp);
|
||||
|
||||
setGizmoPositions();
|
||||
|
||||
|
||||
@@ -1172,7 +1172,7 @@ void TaskHoleParameters::setupGizmos(ViewProviderHole* vp)
|
||||
|
||||
holeDepthGizmo = new LinearGizmo(ui->Depth);
|
||||
|
||||
gizmoContainer = GizmoContainer::createGizmo({holeDepthGizmo}, vp);
|
||||
gizmoContainer = GizmoContainer::create({holeDepthGizmo}, vp);
|
||||
|
||||
setGizmoPositions();
|
||||
}
|
||||
|
||||
@@ -739,7 +739,7 @@ void TaskRevolutionParameters::setupGizmos(ViewProvider* vp)
|
||||
rotationGizmo = new Gui::RadialGizmo(ui->revolveAngle);
|
||||
rotationGizmo2 = new Gui::RadialGizmo(ui->revolveAngle2);
|
||||
|
||||
gizmoContainer = GizmoContainer::createGizmo({rotationGizmo, rotationGizmo2}, vp);
|
||||
gizmoContainer = GizmoContainer::create({rotationGizmo, rotationGizmo2}, vp);
|
||||
rotationGizmo->flipArrow();
|
||||
rotationGizmo2->flipArrow();
|
||||
|
||||
|
||||
@@ -278,7 +278,7 @@ void TaskThicknessParameters::setupGizmos(ViewProviderDressUp* vp)
|
||||
|
||||
linearGizmo = new Gui::LinearGizmo(ui->Value);
|
||||
|
||||
gizmoContainer = GizmoContainer::createGizmo({linearGizmo}, vp);
|
||||
gizmoContainer = GizmoContainer::create({linearGizmo}, vp);
|
||||
|
||||
setGizmoPositions();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user