Stable switch/DOF "PIDs", XML list reload/rehydration, reference points fix, UV layer preservation, performance#54
Stable switch/DOF "PIDs", XML list reload/rehydration, reference points fix, UV layer preservation, performance#54avan069 wants to merge 29 commits into
Conversation
avan069
commented
Jun 8, 2026
- Switch/DOFs are now saved/referenced by their number/branch, not by a flimsy object name. User can manually enter a switch number/branch if known, rather than being forced to scroll the list. Filter box fixed.
- Switch/DOF xml lists can be reloaded safely. Plugin first uses scene-cached switch/DOF names, then retrieves from XML if missing. scene cache can be rehydrated by reloading the xml lists
- Objects are exported with their reference center instead of setting that to geometric mean. This allows user to manipulate reference point to attempt to fix z-fighting issues
- In some cases, the exporter chose the wrong UV layer. More robust now.
- Export performance increased by about 17x - a full size cockpit model export that previously took 13 minutes now completes in ~45 seconds.
- Fix reference points defaulting to geometric origin of meshes, instead use Blender object Origin. - Enable alpha-sorting via reference point/object origin Fix for 47: BenchmarkSims#47
- Reload option for DOF/switch/callback.xml source files added to add-on preferences dialog. - Clears scene/global context/cache then forces reload, avoids persistent cache blocking xml updates.
- Fix BenchmarkSims#21 - At mesh join, rename active UV layer to "UVMap" if required to prevent data loss - Improve performance in join loop by batching join operation - approx 10% performance increase in scenes heavy with non-mesh nodes, approx 50% in scenes heavy with mesh nodes (not thoroughly tested for actual performance gains, but it's definitely better :) )
- Introduce persistent properties for DOF and Switch numbers/branches - Retain backward compatibility for list indices but new method is invariant to xml updates and allows manual switch/dof value editing similar to MAX plugin - Updates to UI panels: Persistent IDs for DOF, Switch/Branch, and auto assignment options for current/collection/scene to set those properties (as plugin operators.) Displays (Switch:Branch) in both UI panel list and object name to quickly identify branches.
Attempt to strengthen handling of UV maps in join operations, particularly use names to avoid stale reference
Filter box now permits filtering by DOF or switch number. For a switch, appending ":" will show all branches for the preceeding switch number. You can still search by name. Creates filter_items() methods for both SwitchList and DofList.
- Implement extensible system for validating a scene at point of export (or whenever) - export_validation.py - Validation pipeline with ExportValidator performing analysis to detect common issues. Returns ValidationIssue (dataclass) objects containing type classification and list of affected objects for resolution - validation_dialogs.py - Dialog operators to guide user through contextual resolution options (eg. execute a batch operation, select issue objects and quit, ignore) Still working on UI and edge cases
- Add common/resolve_ids.py with helpers for resolving DOF and Switch persistent IDs - Replace direct list index access throughout. Refactors dof_editor.py, dof_input_node.py, util.py, and dof_behaviour.py - Prevent IndexError and stale data
- Hydrate DOF/switch lists, prioritizing scene-cached data over disk XML - New preferences to control list reload behavior and warnings. - Updates all usages to prefer persistent IDs, and improves validation/migration dialogs - Refactor related operators/helpers Known: - Still does not entirely guard against switch/dof xml discrepancies if user reloads - some responsibility on user to reload XMLs with "more"/"improved" information - UIList (dof/switch panel) still display incorrect item if cached list is incomplete - should rely on PID first and deselect the list
Agent-Logs-Url: https://github.com/avan069/bms-blender-plugin/sessions/7b05b8fd-880b-48c3-80dc-4c5f35b3d6b5 Co-authored-by: avan069 <14366399+avan069@users.noreply.github.com>
Agent-Logs-Url: https://github.com/avan069/bms-blender-plugin/sessions/7b05b8fd-880b-48c3-80dc-4c5f35b3d6b5 Co-authored-by: avan069 <14366399+avan069@users.noreply.github.com>
Agent-Logs-Url: https://github.com/avan069/bms-blender-plugin/sessions/7b05b8fd-880b-48c3-80dc-4c5f35b3d6b5 Co-authored-by: avan069 <14366399+avan069@users.noreply.github.com>
Agent-Logs-Url: https://github.com/avan069/bms-blender-plugin/sessions/7b05b8fd-880b-48c3-80dc-4c5f35b3d6b5 Co-authored-by: avan069 <14366399+avan069@users.noreply.github.com>
Agent-Logs-Url: https://github.com/avan069/bms-blender-plugin/sessions/d85804fd-fd39-47c0-a3a4-34fa92602caf Co-authored-by: avan069 <14366399+avan069@users.noreply.github.com>
- Persistent switch/DOF numbers/branches stored in scene instead of using flimsy names. Switches/DOfs are resolved centrally to ensure consistent results across different scenes and changes to xml lists. - Switch/DOF lists rehydrated from scene first, then backfilled from XML. - Switch/DOF xml lists can be refreshed in UI
Co-authored-by: avan069 <14366399+avan069@users.noreply.github.com>
Agent-Logs-Url: https://github.com/avan069/bms-blender-plugin/sessions/b5aa89eb-de48-44d8-bbdc-0d1050470e9c Co-authored-by: avan069 <14366399+avan069@users.noreply.github.com>
Agent-Logs-Url: https://github.com/avan069/bms-blender-plugin/sessions/b5aa89eb-de48-44d8-bbdc-0d1050470e9c Co-authored-by: avan069 <14366399+avan069@users.noreply.github.com>
Agent-Logs-Url: https://github.com/avan069/bms-blender-plugin/sessions/4e1f88c8-890d-4861-b4d8-665b99a70076 Co-authored-by: avan069 <14366399+avan069@users.noreply.github.com>
Agent-Logs-Url: https://github.com/avan069/bms-blender-plugin/sessions/cda83d56-97ab-4098-a5e9-50638cdd76ba Co-authored-by: avan069 <14366399+avan069@users.noreply.github.com>
Agent-Logs-Url: https://github.com/avan069/bms-blender-plugin/sessions/cda83d56-97ab-4098-a5e9-50638cdd76ba Co-authored-by: avan069 <14366399+avan069@users.noreply.github.com>
This pull request introduces a performance profiling and batching system to the BML export pipeline. Results in a large complex model with many nodes going from ~13 minutes to ~45 seconds to export. The changes add an ExportProfiler to track and report timings, batch expensive Blender operations, and propagate the profiler through the export stack. Several core functions now accept an export_profiler argument and wrap key operations with profiling stages.
Performance profiling and reporting:
Added an ExportProfiler to the export pipeline, capturing and printing timing information for each major export stage. The profiler is created at the start of export_bml and passed through all relevant functions.
Export duration is now measured with perf_counter for higher accuracy.
Batching and optimization of Blender operations:
Refactored apply_all_modifiers to batch mesh conversion and transform application by hierarchy level, minimizing expensive Blender operator calls and improving performance on large scenes.
Results in a large complex model with many nodes going from ~13 minutes to ~45 seconds to export.Export Performance Improvements
arithex
left a comment
There was a problem hiding this comment.
I'm probably not qualified to review python, for style/idioms etc, but this looks good to me.
I flagged a few spots where I see your GH username .. may want to wash that out before merging to main?
|
If no one has personal gripes, speak now or I'm going to merge this - I recognize it's totally unreviewable in scale, but nobody else is going to fix this plugin, and the version we're providing is broken in too many ways. This is the version I have used extensively for the F-15 cockpit, so I'm very confident in the functionality. I had to arrive at these fixes by being the first person to actually integrate a model using Blender, so I consider each to be essential. (With the exception of performance improvement, I only got around to that after hundreds of 10-15 minute long test exports. I wish I could have that time back.) |