mirror of
https://github.com/allankoechke/ADN-3dsMax-Explode-Geometry.git
synced 2026-12-03 01:02:03 +00:00
[PR #4] [MERGED] feat: feat: add progressbar for expode progress #4
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/allankoechke/ADN-3dsMax-Explode-Geometry/pull/4
Author: @allankoechke
Created: 6/23/2026
Status: ✅ Merged
Merged: 6/24/2026
Merged by: @allankoechke
Base:
master← Head:3-add-explode-progressbar📝 Commits (9)
7c5814cfeat: begin implementation for #3335651afeat: add progress panel widgets to Ui_Form setupUibc719d0feat: wire progress panel show/hide, node labels, and per-face progress callback35c6387feat: move progress panel above explode button and add debug logging toggle6478fabchore: remove accidentally committed pycache artifacts5438bd6feat: print explode duration to Listener on success8c438dafeat: reording timing checkd243965feat: add toggle debug messages & window sizing changes48e226dfeat: updated readme, added running instructions📊 Changes
3 files changed (+335 additions, -94 deletions)
View changed files
📝
Bundle2/Contents/python/explode_geometry.py(+159 -47)📝
Python/explode_geometry.py(+159 -47)📝
README.md(+17 -0)📄 Description
Closes #3
Add Explode Progress Bar Implementation Plan
Overview
Port the C# progress panel (
m_pnlProgressPanel) to the Python UI. A hidden progress container appears when the Explode button is clicked, updates aQProgressBarper-face as each node is processed, and is hidden again before the dialog closes. BothPython/explode_geometry.pyand its identical copyBundle2/Contents/python/explode_geometry.pymust receive the same changes.Current State Analysis
Key Discoveries:
Ui_Form.setupUi()(Python/explode_geometry.py:21-107) builds the entire UI inline -- there is no.uifile loaded at runtimemainLayout(line 104) -- the progress panel goes after itForm.do_explode()(lines 147-198) runs the conversion loops synchronously on the main thread;QApplication.processEvents()is the only way to keep the UI alive during processingconvert_to_triangle_faces()(lines 216-238) iterates faces 1 to N in forward orderconvert_to_mnmesh_faces()(lines 241-261) iterates faces N to 1 in reverse order -- a forward counter must be tracked separately for correct progress displayPython/explode_geometry.pyandBundle2/Contents/python/explode_geometry.pyare byte-for-byte identical and must both be updatedDesired End State
When the user clicks Explode:
QProgressBarfilling from 0 to 100% as faces are processed<name>" and "Node:XofY" (where X/Y are the current/total selected objects)Verification: Run the script in 3ds Max, select a mesh with many faces, click Explode -- the progress bar should visibly advance and the labels should update.
What We Are NOT Doing
.uidesigner file atPython/assets/explode_geometry.ui-- it is not loaded at runtimeapplySettings(),_GCProtector, or any unrelated codeImplementation Approach
self.progress_panel(aQWidgetwithQVBoxLayout, initially hidden) toUi_Form.setupUi()immediately after the explode button, with aQProgressBarand two info rowsretranslateUi()with the static label textForm.do_explode(), show the panel before the loops, set the "total nodes" label, update per-node labels each iteration, and hide the panel after all processingconvert_to_triangle_faces()andconvert_to_mnmesh_faces()as an optionalon_progress=Noneparameter that theFormpasses as a lambda updatingself.progress_barBundle2/Contents/python/explode_geometry.pyIMPORTANT: Checkboxes are for implementation steps only. Steps requiring manual human verification are in the "Manual Testing Steps" section below.
TASK 1: Add Progress Panel Widgets to
Ui_Form[HIGH PRIORITY]Status: DONE
Milestone: Progress panel widget tree exists in
setupUi(), is initially hidden, and all labels have translated textmainLayout.addWidget(self.explode_button)(line 104), createself.progress_panel = QtWidgets.QWidget(Form)withself.progress_panel.setObjectName("progress_panel")progressLayout = QtWidgets.QVBoxLayout(self.progress_panel)with appropriate margins/spacingself.progress_bar = QtWidgets.QProgressBar(self.progress_panel)withsetObjectName("progress_bar"), and setsetMinimum(0),setMaximum(100),setValue(0)QHBoxLayoutnode-name row containing: a fixedQLabel("Processing Node:") andself.lbl_node_name = QtWidgets.QLabel(self.progress_panel)withsetObjectName("lbl_node_name")QHBoxLayoutcounter row containing: a fixedQLabel("Node:"),self.lbl_curr_node = QtWidgets.QLabel(self.progress_panel)(setObjectName("lbl_curr_node")), a fixedQLabel("of"), andself.lbl_tot_node = QtWidgets.QLabel(self.progress_panel)(setObjectName("lbl_tot_node"))self.progress_panel.setVisible(False)to hide it initiallymainLayout.addWidget(self.progress_panel)after the explode button widgetretranslateUi(), addsetTextcalls for the two fixed-text labels ("Processing Node:" and "Node:" / "of") usingQCoreApplication.translateValidation: Open the dialog in Max -- the progress panel must not be visible at startup. Confirm
progress_panel,progress_bar,lbl_node_name,lbl_curr_node, andlbl_tot_nodeexist as attributes on theUi_Forminstance.Requirements from spec:
Files to Modify:
Python/explode_geometry.py--Ui_Form.setupUi()(after line 104) andUi_Form.retranslateUi()(after line 123)TASK 2: Wire Progress Show/Hide and Node Labels in
Form.do_explode()[HIGH PRIORITY]Status: DONE
Milestone: Progress panel appears when Explode is clicked, node name and counter labels update per object, panel hides before dialog closes
elsebranch indo_explode()(line 170, just beforewith pymxs.undo), addself.progress_panel.setVisible(True)andQtWidgets.QApplication.processEvents()forloop (TriMesh at line 174 and MNMesh at line 186), setself.lbl_tot_node.setText(str(len(transformation_set)))forloop (line 174), after the existingprint(...), add:self.lbl_node_name.setText(n.name),self.lbl_curr_node.setText(str(i)),QtWidgets.QApplication.processEvents()forloop (line 186), after the existingprint(...), add:self.lbl_node_name.setText(node.name),self.lbl_curr_node.setText(str(i)),QtWidgets.QApplication.processEvents()_prog(cur, tot)that callsself.progress_bar.setValue(int(cur * 100 / tot) if tot else 0)andQtWidgets.QApplication.processEvents(), then pass it ason_progress=_progtoconvert_to_triangle_faces()(line 176)_progcallback for MNMesh and pass it ason_progress=_progtoconvert_to_mnmesh_faces()(line 188)rt.redrawViews()(line 196) and beforeself.close()(line 198), addself.progress_panel.setVisible(False)andself.progress_bar.setValue(0)Validation: During explode the panel is visible and "Node: 1 of 3" style text updates for each object. After completion the panel disappears before the dialog closes.
Requirements from spec:
Files to Modify:
Python/explode_geometry.py--Form.do_explode()(lines 147-198)TASK 3: Add
on_progressCallback to Conversion Functions [HIGH PRIORITY]Status: DONE
Milestone: Both conversion functions accept an optional
on_progresscallback and call it per face, keeping UI responsiveconvert_to_triangle_faces()signature (line 216), addon_progress=Noneas the last parameterconvert_to_triangle_faces(), before the face loop (after line 221), add:if on_progress: on_progress(0, num_faces)convert_to_triangle_faces()(after theapplySettingscall at line 237), add:if on_progress: on_progress(face_idx, num_faces)convert_to_mnmesh_faces()signature (line 241), addon_progress=Noneas the last parameterconvert_to_mnmesh_faces(), before the face loop (after line 245), add:if on_progress: on_progress(0, num_faces)and introduce_processed = 0convert_to_mnmesh_faces()(after theapplySettingscall at line 260), add:_processed += 1thenif on_progress: on_progress(_processed, num_faces)(note: the loop goes N to 1 in reverse so_processedprovides the forward count)Validation: Both functions can be called without
on_progress(defaultNonepath must not error). When called with a callback, it is invoked once before the loop (at 0) and once per face.Requirements from spec:
ADNUtilities.cs:277-295andADNUtilities.cs:433-449Files to Modify:
Python/explode_geometry.py--convert_to_triangle_faces()(lines 216-238) andconvert_to_mnmesh_faces()(lines 241-261)TASK 4: Mirror All Changes to Bundle2 [HIGH PRIORITY]
Status: DONE
Milestone:
Bundle2/Contents/python/explode_geometry.pyis identical toPython/explode_geometry.pyafter all changesBundle2/Contents/python/explode_geometry.pydiff Python/explode_geometry.py Bundle2/Contents/python/explode_geometry.py-- it should produce no outputValidation:
diff Python/explode_geometry.py Bundle2/Contents/python/explode_geometry.pyreturns exit code 0 with no output.Requirements from spec:
Files to Modify:
Bundle2/Contents/python/explode_geometry.py-- all sections matching Tasks 1-3Testing Strategy
Unit Tests:
Integration Tests:
Python/path and the Bundle2 package pathManual Testing Steps:
Python/andBundle2/paths<name>" and "Node: 1 of 1" labels show correctlyPerformance Considerations
QApplication.processEvents()is called once per face -- this is intentional to keep the UI alive but adds slight overhead. For meshes with thousands of faces this is acceptable; it matches the C# pattern exactly.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.