Su 2023 script - height tag for every vertex in active context - overlay used - performance issues

ChatGPT does not follow correct coding etiquette for a shared Ruby environment.

All of your various codings should be within an unique top level namespace module. Each one of your “plugins” (aka extensions) should be within a submodule of your namespace module.

Ie, it is not proper to be defining classes globally. They should be defined within the extension’s submodule.

Oh yes. Definitely. Unnecessary method calls and assignments take time.

Also, the overlay class documentation warns us to not do heavy calculation within it’s draw() method.
Your code repeatedly recalculates the entire cache in each draw cycle. This really is not the general purpose of a cache mechanism.

Another thing was that you were treating the vertices twice (or more). I called #uniq! upon the vertex array so this would not happen (ie, each vertex handled once during the iteration.) I also skipped vertices whose #z was not > 0.

Try this … it will be version 1.0.0, but it does not yet have observers to update the cache when changes are made to the vertices of the geometry within context. It does separate the cache manipulation from the draw cycles.

You’ll need to control the cache via the extension submenu commands (see bottom of file).

BsFranza_VertexHeightOverlay_1.0.0.rbz (2.7 KB) — See revised edition below (next post)

P.S. - I’ll be on jury duty starting tomorrow so I may be offline for a few days, minimum.