From 1ef9e34b27f6c70bec1fbd910f6bf137cc584322 Mon Sep 17 00:00:00 2001 From: Tyler Fox Date: Wed, 3 Jul 2024 15:56:57 -0700 Subject: [PATCH] Fix when float values are passed to progress bars (#133) * Fix when float values could be passed to progress bars * Update the mac xcode version --- .github/workflows/main.yml | 6 +++--- simplexui/commands/unsubdivide.py | 10 ++++++++-- simplexui/interface/mayaInterface.py | 3 ++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d8f668a..72a6826 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -106,7 +106,7 @@ jobs: - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '13.4' + xcode-version: '15.4' - name: Configure CMake run: | @@ -243,11 +243,11 @@ jobs: - name: Get Correct Python Version uses: actions/setup-python@v5 with: - python-version: '3.7' + python-version: '3.9' - uses: maxim-lobanov/setup-xcode@v1 with: - xcode-version: '13.4' + xcode-version: '15.4' - name: Configure CMake run: | diff --git a/simplexui/commands/unsubdivide.py b/simplexui/commands/unsubdivide.py index 8c1cc3e..91b2d92 100644 --- a/simplexui/commands/unsubdivide.py +++ b/simplexui/commands/unsubdivide.py @@ -191,6 +191,12 @@ def partitionIslands(faces, neigh, pBar=None): allVerts = set(chain.from_iterable(faces)) islands = [] count = float(len(allVerts)) + + if pBar is not None: + pBar.setValue(0) + pBar.setMaximum(count) + QApplication.processEvents() + while allVerts: verts = set([allVerts.pop()]) exclude = set() @@ -200,7 +206,7 @@ def partitionIslands(faces, neigh, pBar=None): allVerts.difference_update(exclude) if pBar is not None: - pBar.setValue(100 * (count - len(allVerts)) / count) + pBar.setValue(count - len(allVerts)) QApplication.processEvents() return islands @@ -271,7 +277,7 @@ def getFaceCenterDel(faces, eNeigh, hints, pBar=None): vertToFaces.setdefault(f, []).append(i) vc.add(f) - count = float(len(vc)) + count = len(vc) centers = set() midpoints = set() originals = set(hints) diff --git a/simplexui/interface/mayaInterface.py b/simplexui/interface/mayaInterface.py index 050f5c2..a645881 100644 --- a/simplexui/interface/mayaInterface.py +++ b/simplexui/interface/mayaInterface.py @@ -771,12 +771,13 @@ def getAllShapeVertices(self, shapes, pBar=None): # find the longest name for displaying stuff sns = "_" * max(list(map(len, [s.name for s in shapes]))) pBar.setLabelText("Getting Shape:\n{0}".format(sns)) + pBar.setMaximum(len(shapes)) QApplication.processEvents() for i, shape in enumerate(shapes): if pBar is not None: pBar.setLabelText("Getting Shape:\n{0}".format(shape.name)) - pBar.setValue((100.0 * i) / len(shapes)) + pBar.setValue(i) QApplication.processEvents() cmds.setAttr(shape.thing, 1.0)