Clean-up code and improve formatting
This commit is contained in:
@@ -1875,6 +1875,7 @@ void Application::initApplication()
|
||||
|
||||
void Application::initTypes()
|
||||
{
|
||||
// clang-format off
|
||||
// views
|
||||
Gui::BaseView ::init();
|
||||
Gui::MDIView ::init();
|
||||
@@ -1945,6 +1946,7 @@ void Application::initTypes()
|
||||
// register transaction type
|
||||
new App::TransactionProducer<TransactionViewProvider>
|
||||
(ViewProviderDocumentObject::getClassTypeId());
|
||||
// clang-format on
|
||||
}
|
||||
|
||||
void Application::initOpenInventor()
|
||||
|
||||
@@ -22,10 +22,8 @@
|
||||
|
||||
#include "PreCompiled.h"
|
||||
|
||||
#include <App/Color.h>
|
||||
#include <App/PropertyStandard.h>
|
||||
|
||||
#include "Application.h"
|
||||
#include "DlgMaterialPropertiesImp.h"
|
||||
#include "ui_DlgMaterialProperties.h"
|
||||
#include "ViewProvider.h"
|
||||
|
||||
@@ -96,7 +96,6 @@ public:
|
||||
|
||||
/// Get the python wrapper for that ViewProvider
|
||||
PyObject* getPyObject() override;
|
||||
static App::Material getUserDefinedMaterial();
|
||||
|
||||
protected:
|
||||
/// get called by the container whenever a property has been changed
|
||||
|
||||
@@ -109,7 +109,6 @@ private:
|
||||
PyObject* initModule()
|
||||
{
|
||||
return Base::Interpreter().addModule(new Module);
|
||||
;
|
||||
}
|
||||
|
||||
} // namespace PartGui
|
||||
@@ -140,15 +139,17 @@ PyMOD_INIT_FUNC(PartGui)
|
||||
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/parametric"));
|
||||
Gui::BitmapFactory().addPath(QString::fromLatin1(":/icons/tools"));
|
||||
|
||||
static struct PyModuleDef pAttachEngineTextsModuleDef = {PyModuleDef_HEAD_INIT,
|
||||
"AttachEngineResources",
|
||||
"AttachEngineResources",
|
||||
-1,
|
||||
AttacherGui::AttacherGuiPy::Methods,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr,
|
||||
nullptr};
|
||||
// clang-format off
|
||||
static struct PyModuleDef pAttachEngineTextsModuleDef = {
|
||||
PyModuleDef_HEAD_INIT,
|
||||
"AttachEngineResources",
|
||||
"AttachEngineResources",
|
||||
-1,
|
||||
AttacherGui::AttacherGuiPy::Methods,
|
||||
nullptr, nullptr, nullptr, nullptr
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
PyObject* pAttachEngineTextsModule = PyModule_Create(&pAttachEngineTextsModuleDef);
|
||||
|
||||
Py_INCREF(pAttachEngineTextsModule);
|
||||
@@ -218,7 +219,6 @@ PyMOD_INIT_FUNC(PartGui)
|
||||
PartGui::Workbench ::init();
|
||||
auto manip = std::make_shared<PartGui::WorkbenchManipulator>();
|
||||
Gui::WorkbenchManipulator::installManipulator(manip);
|
||||
// clang-format on
|
||||
|
||||
// instantiating the commands
|
||||
CreatePartCommands();
|
||||
@@ -226,8 +226,8 @@ PyMOD_INIT_FUNC(PartGui)
|
||||
CreateParamPartCommands();
|
||||
CreatePartSelectCommands();
|
||||
try {
|
||||
Py::Object ae =
|
||||
Base::Interpreter().runStringObject("__import__('AttachmentEditor.Commands').Commands");
|
||||
const char* cmd = "__import__('AttachmentEditor.Commands').Commands";
|
||||
Py::Object ae = Base::Interpreter().runStringObject(cmd);
|
||||
Py::Module(partGuiModule).setAttr(std::string("AttachmentEditor"), ae);
|
||||
}
|
||||
catch (Base::PyException& err) {
|
||||
@@ -235,29 +235,18 @@ PyMOD_INIT_FUNC(PartGui)
|
||||
}
|
||||
|
||||
// register preferences pages
|
||||
Gui::Dialog::DlgPreferencesImp::setGroupData("Part/Part Design",
|
||||
"Part design",
|
||||
QObject::tr("Part and Part Design workbench"));
|
||||
(void)new Gui::PrefPageProducer<PartGui::DlgSettingsGeneral>(
|
||||
QT_TRANSLATE_NOOP("QObject", "Part/Part Design"));
|
||||
(void)new Gui::PrefPageProducer<PartGui::DlgSettings3DViewPart>(
|
||||
QT_TRANSLATE_NOOP("QObject", "Part/Part Design"));
|
||||
(void)new Gui::PrefPageProducer<PartGui::DlgSettingsObjectColor>(
|
||||
QT_TRANSLATE_NOOP("QObject", "Part/Part Design"));
|
||||
(void)new Gui::PrefPageProducer<PartGui::DlgImportExportIges>(
|
||||
QT_TRANSLATE_NOOP("QObject", "Import-Export"));
|
||||
(void)new Gui::PrefPageProducer<PartGui::DlgImportExportStep>(
|
||||
QT_TRANSLATE_NOOP("QObject", "Import-Export"));
|
||||
Gui::Dialog::DlgPreferencesImp::setGroupData("Part/Part Design", "Part design", QObject::tr("Part and Part Design workbench"));
|
||||
(void)new Gui::PrefPageProducer<PartGui::DlgSettingsGeneral>(QT_TRANSLATE_NOOP("QObject", "Part/Part Design"));
|
||||
(void)new Gui::PrefPageProducer<PartGui::DlgSettings3DViewPart>(QT_TRANSLATE_NOOP("QObject", "Part/Part Design"));
|
||||
(void)new Gui::PrefPageProducer<PartGui::DlgSettingsObjectColor>(QT_TRANSLATE_NOOP("QObject", "Part/Part Design"));
|
||||
(void)new Gui::PrefPageProducer<PartGui::DlgImportExportIges>(QT_TRANSLATE_NOOP("QObject", "Import-Export"));
|
||||
(void)new Gui::PrefPageProducer<PartGui::DlgImportExportStep>(QT_TRANSLATE_NOOP("QObject", "Import-Export"));
|
||||
Gui::ViewProviderBuilder::add(Part::PropertyPartShape::getClassTypeId(),
|
||||
PartGui::ViewProviderPart::getClassTypeId());
|
||||
// clang-format on
|
||||
|
||||
// add resources and reloads the translators
|
||||
loadPartResource();
|
||||
|
||||
// register bitmaps
|
||||
// Gui::BitmapFactoryInst& rclBmpFactory = Gui::BitmapFactory();
|
||||
// rclBmpFactory.addXPM("Part_Feature",(const char**) PartFeature_xpm);
|
||||
// rclBmpFactory.addXPM("Part_FeatureImport",(const char**) PartFeatureImport_xpm);
|
||||
|
||||
PyMOD_Return(partGuiModule);
|
||||
}
|
||||
|
||||
@@ -720,38 +720,34 @@ void PartGui::DlgProjectionOnSurface::higlight_object(Part::Feature* iCurrentObj
|
||||
auto vp = dynamic_cast<PartGui::ViewProviderPartExt*>(
|
||||
Gui::Application::Instance->getViewProvider(iCurrentObject));
|
||||
if (vp) {
|
||||
App::Color aColor;
|
||||
aColor.setPackedValue(iColor);
|
||||
std::vector<App::Color> colors;
|
||||
App::Color defaultColor;
|
||||
if (currentShapeType == TopAbs_FACE) {
|
||||
std::vector<App::Material> colors = vp->ShapeAppearance.getValues();
|
||||
App::Color defaultColor = vp->ShapeAppearance.getDiffuseColor();
|
||||
|
||||
if (static_cast<Standard_Integer>(colors.size()) != anIndices.Extent()) {
|
||||
colors.resize(anIndices.Extent(), vp->ShapeAppearance[0]);
|
||||
}
|
||||
|
||||
if (iHighlight) {
|
||||
colors.at(index - 1).diffuseColor = aColor;
|
||||
}
|
||||
else {
|
||||
colors.at(index - 1).diffuseColor = defaultColor;
|
||||
}
|
||||
vp->ShapeAppearance.setValues(colors);
|
||||
colors = vp->ShapeAppearance.getDiffuseColors();
|
||||
defaultColor = colors.front();
|
||||
}
|
||||
else if (currentShapeType == TopAbs_EDGE) {
|
||||
std::vector<App::Color> colors = vp->LineColorArray.getValues();
|
||||
App::Color defaultColor = vp->LineColor.getValue();
|
||||
colors = vp->LineColorArray.getValues();
|
||||
defaultColor = vp->LineColor.getValue();
|
||||
}
|
||||
|
||||
if (static_cast<Standard_Integer>(colors.size()) != anIndices.Extent()) {
|
||||
colors.resize(anIndices.Extent(), defaultColor);
|
||||
}
|
||||
if (static_cast<Standard_Integer>(colors.size()) != anIndices.Extent()) {
|
||||
colors.resize(anIndices.Extent(), defaultColor);
|
||||
}
|
||||
|
||||
if (iHighlight) {
|
||||
colors.at(index - 1) = aColor;
|
||||
}
|
||||
else {
|
||||
colors.at(index - 1) = defaultColor;
|
||||
}
|
||||
if (iHighlight) {
|
||||
App::Color aColor;
|
||||
aColor.setPackedValue(iColor);
|
||||
colors.at(index - 1) = aColor;
|
||||
}
|
||||
else {
|
||||
colors.at(index - 1) = defaultColor;
|
||||
}
|
||||
if (currentShapeType == TopAbs_FACE) {
|
||||
vp->ShapeAppearance.setDiffuseColors(colors);
|
||||
}
|
||||
else if (currentShapeType == TopAbs_EDGE) {
|
||||
vp->LineColorArray.setValues(colors);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -172,8 +172,8 @@ void ViewProviderSections::highlightReferences(ShapeType type, const References&
|
||||
// check again that the index is in range because it's possible that
|
||||
// the sub-names are invalid
|
||||
if (idx < materials.size()) {
|
||||
materials[idx].diffuseColor =
|
||||
App::Color(1.0, 0.0, 1.0); // magenta
|
||||
// magenta
|
||||
materials[idx].diffuseColor = App::Color(1.0, 0.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user