[Script] WME Straighten Up!
WME Straighten Up! (WME SU!)
Version: 2024.01.31.01
Greasyfork: https://greasyfork.org/en/scripts/38834 ... aighten-up
Description: Straighten selected WME segment(s) by aligning along straight line between two end points and removing geometry nodes.
Developer(s): dBsooner through WazeDev. WazeDev owns the script and all information attached to it.
Special note: Due to the nature of this script, it will not work for editors rank 1 or 2.
Feature list:
History: I have worked with an author of a script that wasn't well known that would straighten segments by move nodes to a straight line along a vector between two other points. I took their original code and modified it to be quicker, more reliable and provide some additional features and safety measures.
Special thanks: jonny3D (and impulse200) for allowing me to fork his / their work to create this.
Screenshots:
https://i.ibb.co/1LTWC7S/Crooked-St1.png https://i.ibb.co/F0M3Nmk/Crooked-St2.png
https://i.ibb.co/7tg714D/SU-1.png https://i.ibb.co/pjgRBHX/SU-2.png
Version: 2024.01.31.01
Greasyfork: https://greasyfork.org/en/scripts/38834 ... aighten-up
Description: Straighten selected WME segment(s) by aligning along straight line between two end points and removing geometry nodes.
Developer(s): dBsooner through WazeDev. WazeDev owns the script and all information attached to it.
Special note: Due to the nature of this script, it will not work for editors rank 1 or 2.
Feature list:
- Straighten selected segments so they are all in a perfectly straight line between the two endpoint junction nodes. This is done by moving the JNs between the endpoints to the nearest point on the vector line between the two endpoints.
- All segments must be at least partially in the current view of the map.
- Recommended to only select continuous segments and segments share at least one name in common.
- Shortcut to run script available under editing shortcuts in WME.
- Translatable into any supported WME language. (Calling anyone that wants to assist in translating... PM me.)
- Safety checks for:
- Segments with conflicting names.
- Long junction node moves (when a JN would move a distance greater than 10m).
- Micro doglegs (mDL) checks:
- 1 segment selected: Will check for existence of a geometry node within 2 meters, on the selected segment only, of either junction node.
- More than 1 segment selected: Will check for existence of a geometry node within 2 meters of all junction nodes on all segments connected to the junction node, regardless if the segments are in the selection or not. The reason is if the junction node is moved, it could affect the angle of a mDL on any segment, not just the segments selected.
- Non-continuous selected segments (when selected segments don't form a continuous selection).
- Sanity check (when you select more than 10 segments at once).
- Select the starting segment.
- ALT+click the ending segment.
Note: If the segments you wanted to straighten are not all selected, unselect the segmens and start over using CTRL+click to select each segment instead. - Click "Straighten up!" button in the sidebar.
Code: Select all
2024.01.31.01: BUGFIX: Check for micro dog leg (mDL)
2024.01.22.01: CHANGE: Compatibility with recent WME releases. (Thank you jangliss)
2023.08.02.01: CHANGE: WME release v2.180-7-geb388e8d3 compatibility.
2023.05.10.01: CHANGE: Reverted to 100% vanilla JavaScript, removing reliance on jQuery.
CHANGE: Moved button and removed extra code no longer needed.
CHANGE: Switch to WazeWrap for script update checking.
2023.04.19.01: CHANGE: WME production now includes function from WME beta.
2023.04.03.01: NEW: Check for updated version on load.
CHANGE: Future (possible) WME changes preparation.
2023.03.15.01: CHANGE: New bootstrap routine.
CHANGE: Updated code to use optional chaining.
CHANGE: Code structure with new linter options.
CHANGE: Code cleanup.
CHANGE: Utilize @match instead of @include in userscript headers.
CHANGE: WazeWrap compatibility.
2022.08.26.01: BUGFIX: Minor bugfixes.
2022.07.05.01: CHANGE: Compatibility with latest WME update.
2020.07.27.01: NEW: Shortcut to run Straighten Up!
CHANGE: WME map object references.
2020.06.16.01: CHANGE: Keep button displayed during segment editing.
2019.12.06.02: CHANGE: Move button closer to top of side panel.
2019.12.06.01: CHANGE: WME v2.43-40-gf367bffa4 compatibility.
2019.10.18.01: NEW: Add button if loading segment selection via permalink.
2019.08.26.01: CHANGE: Added ru translation.
CHANGE: Detect if selected segments are already straight.
2019.08.16.01: CHANGE: Enhance check for micro doglegs (mDL).
2019.08.15.01: NEW: Initial release.
Special thanks: jonny3D (and impulse200) for allowing me to fork his / their work to create this.
Screenshots:
https://i.ibb.co/1LTWC7S/Crooked-St1.png https://i.ibb.co/F0M3Nmk/Crooked-St2.png
https://i.ibb.co/7tg714D/SU-1.png https://i.ibb.co/pjgRBHX/SU-2.png
Re: [Script] WME Straighten Up!