From a575e6c7cbc08f6f235345c62458e8ff19949b16 Mon Sep 17 00:00:00 2001
From: Syres916 <46537884+Syres916@users.noreply.github.com>
Date: Mon, 15 Jan 2024 13:43:58 +0000
Subject: [PATCH 01/36] [Gui] [Tux] Fix Nav Style Icons and theme recognition
---
src/Mod/Tux/NavigationIndicatorGui.py | 37 ++++++++++----
src/Mod/Tux/Resources/Tux.qrc | 6 ++-
.../icons/NavigationOpenSCAD_dark.svg | 50 +++++++++++++++++++
.../icons/NavigationOpenSCAD_light.svg | 50 +++++++++++++++++++
.../icons/NavigationTinkerCAD_dark.svg | 50 +++++++++++++++++++
.../icons/NavigationTinkerCAD_light.svg | 50 +++++++++++++++++++
6 files changed, 230 insertions(+), 13 deletions(-)
create mode 100644 src/Mod/Tux/Resources/icons/NavigationOpenSCAD_dark.svg
create mode 100644 src/Mod/Tux/Resources/icons/NavigationOpenSCAD_light.svg
create mode 100644 src/Mod/Tux/Resources/icons/NavigationTinkerCAD_dark.svg
create mode 100644 src/Mod/Tux/Resources/icons/NavigationTinkerCAD_light.svg
diff --git a/src/Mod/Tux/NavigationIndicatorGui.py b/src/Mod/Tux/NavigationIndicatorGui.py
index e20c0be897..c05feb1ba2 100644
--- a/src/Mod/Tux/NavigationIndicatorGui.py
+++ b/src/Mod/Tux/NavigationIndicatorGui.py
@@ -28,7 +28,7 @@ mw = Gui.getMainWindow()
statusBar = mw.statusBar()
p = App.ParamGet("User parameter:Tux/NavigationIndicator")
pView = App.ParamGet("User parameter:BaseApp/Preferences/View")
-
+pMWin = App.ParamGet("User parameter:BaseApp/Preferences/MainWindow")
try:
_encoding = QtGui.QApplication.UnicodeUTF8
@@ -62,6 +62,29 @@ class IndicatorButton(QtGui.QPushButton):
if param == "NavigationStyle":
setCurrent()
+ def mousePressEvent(self, event):
+ RePopulateIcons()
+ return super(IndicatorButton, self).mousePressEvent(event)
+
+
+def RePopulateIcons():
+ curStyleSheet = pMWin.GetString("StyleSheet")
+ if "dark" in curStyleSheet.lower():
+ StyleSheetType = "light"
+ else:
+ StyleSheetType = "dark"
+
+ a1.setIcon(QtGui.QIcon(":/icons/NavigationBlender_" + StyleSheetType + ".svg"))
+ a2.setIcon(QtGui.QIcon(":/icons/NavigationCAD_" + StyleSheetType + ".svg"))
+ a3.setIcon(QtGui.QIcon(":/icons/NavigationGesture_" + StyleSheetType + ".svg"))
+ a4.setIcon(QtGui.QIcon(":/icons/NavigationMayaGesture_" + StyleSheetType + ".svg"))
+ a5.setIcon(QtGui.QIcon(":/icons/NavigationOpenCascade_" + StyleSheetType + ".svg"))
+ a6.setIcon(QtGui.QIcon(":/icons/NavigationOpenInventor_" + StyleSheetType + ".svg"))
+ a7.setIcon(QtGui.QIcon(":/icons/NavigationOpenSCAD_" + StyleSheetType + ".svg"))
+ a8.setIcon(QtGui.QIcon(":/icons/NavigationRevit_" + StyleSheetType + ".svg"))
+ a9.setIcon(QtGui.QIcon(":/icons/NavigationTinkerCAD_" + StyleSheetType + ".svg"))
+ a10.setIcon(QtGui.QIcon(":/icons/NavigationTouchpad_" + StyleSheetType + ".svg"))
+
def retranslateUi():
"""Retranslate navigation indicator on language change"""
@@ -602,65 +625,57 @@ a0.setData("Undefined ")
a0.setObjectName("Indicator_NavigationUndefined")
a1 = QtGui.QAction(gStyle)
-a1.setIcon(QtGui.QIcon(":/icons/NavigationBlender_dark.svg"))
a1.setText("Blender ")
a1.setData("Gui::BlenderNavigationStyle")
a1.setObjectName("Indicator_NavigationBlender")
a2 = QtGui.QAction(gStyle)
-a2.setIcon(QtGui.QIcon(":/icons/NavigationCAD_dark.svg"))
a2.setText("CAD ")
a2.setData("Gui::CADNavigationStyle")
a2.setObjectName("Indicator_NavigationCAD")
a3 = QtGui.QAction(gStyle)
-a3.setIcon(QtGui.QIcon(":/icons/NavigationGesture_dark.svg"))
a3.setText("Gesture ")
a3.setData("Gui::GestureNavigationStyle")
a3.setObjectName("Indicator_NavigationGesture")
a4 = QtGui.QAction(gStyle)
-a4.setIcon(QtGui.QIcon(":/icons/NavigationMayaGesture_dark.svg"))
a4.setText("MayaGesture ")
a4.setData("Gui::MayaGestureNavigationStyle")
a4.setObjectName("Indicator_NavigationMayaGesture")
a5 = QtGui.QAction(gStyle)
-a5.setIcon(QtGui.QIcon(":/icons/NavigationOpenCascade_dark.svg"))
a5.setText("OpenCascade ")
a5.setData("Gui::OpenCascadeNavigationStyle")
a5.setObjectName("Indicator_NavigationOpenCascade")
a6 = QtGui.QAction(gStyle)
-a6.setIcon(QtGui.QIcon(":/icons/NavigationOpenInventor_dark.svg"))
a6.setText("OpenInventor ")
a6.setData("Gui::InventorNavigationStyle")
a6.setObjectName("Indicator_NavigationOpenInventor")
a7 = QtGui.QAction(gStyle)
-a7.setIcon(QtGui.QIcon(":/icons/NavigationOpenSCAD_dark.svg"))
a7.setText("OpenSCAD ")
a7.setData("Gui::OpenSCADNavigationStyle")
a7.setObjectName("Indicator_NavigationOpenSCAD")
a8 = QtGui.QAction(gStyle)
-a8.setIcon(QtGui.QIcon(":/icons/NavigationRevit_dark.svg"))
a8.setText("Revit ")
a8.setData("Gui::RevitNavigationStyle")
a8.setObjectName("Indicator_NavigationRevit")
a9 = QtGui.QAction(gStyle)
-a9.setIcon(QtGui.QIcon(":/icons/NavigationTinkerCAD_dark.svg"))
a9.setText("TinkerCAD ")
a9.setData("Gui::TinkerCADNavigationStyle")
a9.setObjectName("Indicator_NavigationTinkerCAD")
a10 = QtGui.QAction(gStyle)
-a10.setIcon(QtGui.QIcon(":/icons/NavigationTouchpad_dark.svg"))
a10.setText("Touchpad ")
a10.setData("Gui::TouchpadNavigationStyle")
a10.setObjectName("Indicator_NavigationTouchpad")
+RePopulateIcons()
+
menu.addMenu(menuSettings)
menu.addSeparator()
menu.addAction(a0)
diff --git a/src/Mod/Tux/Resources/Tux.qrc b/src/Mod/Tux/Resources/Tux.qrc
index 69dfb4ee3a..483eedd537 100644
--- a/src/Mod/Tux/Resources/Tux.qrc
+++ b/src/Mod/Tux/Resources/Tux.qrc
@@ -58,13 +58,15 @@
icons/NavigationOpenInventor_dark.svg
icons/NavigationOpenInventor_ZoomAlt.svg
icons/NavigationOpenInventor_Zoom.svg
- icons/NavigationCAD_dark.svg
+ icons/NavigationOpenSCAD_light.svg
+ icons/NavigationOpenSCAD_dark.svg
icons/NavigationOpenCascade_Select.svg
icons/NavigationOpenCascade_PanAlt.svg
icons/NavigationOpenCascade_PanAlt.svg
icons/NavigationOpenCascade_Select.svg
icons/NavigationGesture_Pan.svg
- icons/NavigationCAD_dark.svg
+ icons/NavigationTinkerCAD_light.svg
+ icons/NavigationTinkerCAD_dark.svg
icons/NavigationOpenCascade_Select.svg
icons/NavigationOpenCascade_Zoom.svg
icons/NavigationGesture_Pan.svg
diff --git a/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_dark.svg b/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_dark.svg
new file mode 100644
index 0000000000..1ec124fba1
--- /dev/null
+++ b/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_dark.svg
@@ -0,0 +1,50 @@
+
+
+
+
diff --git a/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_light.svg b/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_light.svg
new file mode 100644
index 0000000000..c3829d9c93
--- /dev/null
+++ b/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_light.svg
@@ -0,0 +1,50 @@
+
+
+
+
diff --git a/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_dark.svg b/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_dark.svg
new file mode 100644
index 0000000000..b21d4bacdf
--- /dev/null
+++ b/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_dark.svg
@@ -0,0 +1,50 @@
+
+
+
+
diff --git a/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_light.svg b/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_light.svg
new file mode 100644
index 0000000000..5d011b3d0d
--- /dev/null
+++ b/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_light.svg
@@ -0,0 +1,50 @@
+
+
+
+
From e95c553391f1ef01ea5156f59253ce20ab6c30ba Mon Sep 17 00:00:00 2001
From: Syres916 <46537884+Syres916@users.noreply.github.com>
Date: Mon, 15 Jan 2024 13:58:27 +0000
Subject: [PATCH 02/36] [Gui] [Tux] Correct text location in icons
---
.../Tux/Resources/icons/NavigationOpenSCAD_dark.svg | 4 ++--
.../Tux/Resources/icons/NavigationOpenSCAD_light.svg | 4 ++--
.../Tux/Resources/icons/NavigationTinkerCAD_dark.svg | 10 +++++-----
.../Tux/Resources/icons/NavigationTinkerCAD_light.svg | 10 +++++-----
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_dark.svg b/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_dark.svg
index 1ec124fba1..a2eba9ffcc 100644
--- a/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_dark.svg
+++ b/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_dark.svg
@@ -41,10 +41,10 @@
OS
diff --git a/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_light.svg b/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_light.svg
index c3829d9c93..d6900e002c 100644
--- a/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_light.svg
+++ b/src/Mod/Tux/Resources/icons/NavigationOpenSCAD_light.svg
@@ -41,10 +41,10 @@
OS
diff --git a/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_dark.svg b/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_dark.svg
index b21d4bacdf..aaa6e7faab 100644
--- a/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_dark.svg
+++ b/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_dark.svg
@@ -40,11 +40,11 @@
T
+ x="27.425451"
+ y="45.400135">T
diff --git a/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_light.svg b/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_light.svg
index 5d011b3d0d..6b4101c00f 100644
--- a/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_light.svg
+++ b/src/Mod/Tux/Resources/icons/NavigationTinkerCAD_light.svg
@@ -40,11 +40,11 @@
T
+ x="27.425451"
+ y="45.400135">T
From c1b296dab807153af653f63d22272cdd805d909a Mon Sep 17 00:00:00 2001
From: "Zheng, Lei"
Date: Mon, 15 Jan 2024 22:41:24 -0500
Subject: [PATCH 03/36] ShapeMapper code from RT branch to new TopoShapeMapper
files
---
src/Mod/Part/App/CMakeLists.txt | 2 +
src/Mod/Part/App/TopoShape.h | 56 ++++++
src/Mod/Part/App/TopoShapeMapper.cpp | 75 ++++++++
src/Mod/Part/App/TopoShapeMapper.h | 255 +++++++++++++++++++++++++++
4 files changed, 388 insertions(+)
create mode 100644 src/Mod/Part/App/TopoShapeMapper.cpp
create mode 100644 src/Mod/Part/App/TopoShapeMapper.h
diff --git a/src/Mod/Part/App/CMakeLists.txt b/src/Mod/Part/App/CMakeLists.txt
index bf0ce716eb..1a85f3b620 100644
--- a/src/Mod/Part/App/CMakeLists.txt
+++ b/src/Mod/Part/App/CMakeLists.txt
@@ -533,6 +533,8 @@ SET(Part_SRCS
TopoShapeCache.cpp
TopoShapeCache.h
TopoShapeExpansion.cpp
+ TopoShapeMapper.h
+ TopoShapeMapper.cpp
TopoShapeOpCode.h
edgecluster.cpp
edgecluster.h
diff --git a/src/Mod/Part/App/TopoShape.h b/src/Mod/Part/App/TopoShape.h
index ad4ef2a780..a80ce07946 100644
--- a/src/Mod/Part/App/TopoShape.h
+++ b/src/Mod/Part/App/TopoShape.h
@@ -613,6 +613,27 @@ public:
bool hasPendingElementMap() const;
+ /** Helper class to return the generated and modified shape given an input shape
+ *
+ * Shape history information is extracted using OCCT APIs
+ * BRepBuilderAPI_MakeShape::Generated/Modified(). However, there is often
+ * some glitches in various derived class. So we use this class as an
+ * abstraction, and create various derived classes to deal with the glitches.
+ */
+ struct PartExport Mapper {
+ /// Helper vector for temporary storage of both generated and modified shapes
+ mutable std::vector _res;
+ virtual ~Mapper() {}
+ /// Return a list of shape generated from the given input shape
+ virtual const std::vector &generated(const TopoDS_Shape &) const {
+ return _res;
+ }
+ /// Return a list of shape modified from the given input shape
+ virtual const std::vector &modified(const TopoDS_Shape &) const {
+ return _res;
+ }
+ };
+
/** Make a compound shape
*
* @param shapes: input shapes
@@ -629,6 +650,41 @@ public:
*/
TopoShape &makeElementCompound(const std::vector &shapes, const char *op=nullptr, bool force=true);
+ struct BRepFillingParams;
+
+ /** Provides information about the continuity of a curve.
+ * Corresponds to OCCT type GeomAbs_Shape
+ */
+ enum class Continuity {
+ /// Only geometric continuity
+ C0,
+ /** for each point on the curve, the tangent vectors 'on the right' and 'on
+ * the left' are collinear with the same orientation.
+ */
+ G1,
+ /** Continuity of the first derivative. The 'C1' curve is also 'G1' but, in
+ * addition, the tangent vectors 'on the right' and 'on the left' are equal.
+ */
+ C1,
+
+ /** For each point on the curve, the normalized normal vectors 'on the
+ * right' and 'on the left' are equal.
+ */
+ G2,
+
+ /// Continuity of the second derivative.
+ C2,
+
+ /// Continuity of the third derivative.
+ C3,
+
+ /** Continuity of the N-th derivative, whatever is the value given for N
+ * (infinite order of continuity). Also provides information about the
+ * continuity of a surface.
+ */
+ CN,
+ };
+
friend class TopoShapeCache;
private:
diff --git a/src/Mod/Part/App/TopoShapeMapper.cpp b/src/Mod/Part/App/TopoShapeMapper.cpp
new file mode 100644
index 0000000000..89ea456a40
--- /dev/null
+++ b/src/Mod/Part/App/TopoShapeMapper.cpp
@@ -0,0 +1,75 @@
+#include "TopoShapeMapper.h"
+
+namespace Part
+{
+
+void ShapeMapper::expand(const TopoDS_Shape &d, std::vector &shapes)
+{
+ if (d.IsNull()) return;
+ for(TopExp_Explorer xp(d, TopAbs_FACE);xp.More();xp.Next())
+ shapes.push_back(xp.Current());
+ for(TopExp_Explorer xp(d, TopAbs_EDGE, TopAbs_FACE);xp.More();xp.Next())
+ shapes.push_back(xp.Current());
+ for(TopExp_Explorer xp(d, TopAbs_VERTEX, TopAbs_EDGE);xp.More();xp.Next())
+ shapes.push_back(xp.Current());
+}
+
+void ShapeMapper::populate(bool generated,
+ const TopTools_ListOfShape &src,
+ const TopTools_ListOfShape &dst)
+{
+ for(TopTools_ListIteratorOfListOfShape it(src);it.More();it.Next())
+ populate(generated, it.Value(), dst);
+}
+
+void ShapeMapper::populate(bool generated,
+ const TopoShape &src,
+ const TopTools_ListOfShape &dst)
+{
+ if(src.isNull())
+ return;
+ std::vector dstShapes;
+ for(TopTools_ListIteratorOfListOfShape it(dst);it.More();it.Next())
+ expand(it.Value(), dstShapes);
+ insert(generated, src.getShape(), dstShapes);
+}
+
+void ShapeMapper::insert(bool generated, const TopoDS_Shape &s, const TopoDS_Shape &d)
+{
+ if (s.IsNull() || d.IsNull()) return;
+ // Prevent an element shape from being both generated and modified
+ if (generated) {
+ if (_modifiedShapes.count(d))
+ return;
+ _generatedShapes.insert(d);
+ } else {
+ if( _generatedShapes.count(d))
+ return;
+ _modifiedShapes.insert(d);
+ }
+ auto &entry = generated?_generated[s]:_modified[s];
+ if(entry.shapeSet.insert(d).second)
+ entry.shapes.push_back(d);
+};
+
+void ShapeMapper::insert(bool generated, const TopoDS_Shape &s, const std::vector &d)
+{
+ if (s.IsNull() || d.empty()) return;
+ auto &entry = generated?_generated[s]:_modified[s];
+ for(auto &shape : d) {
+ // Prevent an element shape from being both generated and modified
+ if (generated) {
+ if (_modifiedShapes.count(shape))
+ continue;
+ _generatedShapes.insert(shape);
+ } else {
+ if( _generatedShapes.count(shape))
+ continue;
+ _modifiedShapes.insert(shape);
+ }
+ if(entry.shapeSet.insert(shape).second)
+ entry.shapes.push_back(shape);
+ }
+};
+
+}
diff --git a/src/Mod/Part/App/TopoShapeMapper.h b/src/Mod/Part/App/TopoShapeMapper.h
new file mode 100644
index 0000000000..736aebc21c
--- /dev/null
+++ b/src/Mod/Part/App/TopoShapeMapper.h
@@ -0,0 +1,255 @@
+#include