Notifications
Clear all

[Closed] ProOptimizer.VertexCount not updating

Converting to mesh is working perfectly, I don’t care about preserving the stack since ultimately I’m exporting this as an FBX anyway. Unfortunately I can’t use BatchProOptimizer because of how I’m calculating the optimization for each object. Forcing redraw seems fairly slow however, is there any alternative I can use that will force the updated vertex count to take that is faster?

You could try with (classof $) instead of redrawing.
Also turn off the whole app redrawing, hide the nodes.

Selecting the object also does take a lot of time when in Modify Panel. But it seems it is required to make the modifier work.


(
    fn Decimate obj count = with redraw off with undo off
    (
        select obj
        mdf = prooptimizer()
        addmodifier obj mdf
        mdf.calculate = on
        
        classof obj        /* instead of completeredraw() */
        
        mdf.vertexcount = count
        converttomesh obj
    )
    
    WM_SETREDRAW = 11
    windows.sendmessage (windows.getMAXHWND()) WM_SETREDRAW 0 0    /* redraw off */
        
    gc()
    delete objects

    max modify mode

    nodes = for j = 1 to 100 collect teapot pos:[j*80,0,0] wirecolor:green
    
    hide nodes    /* Hide nodes (not sure if it will have a big impact */
    
    st=timestamp(); sh=heapfree
    
    for j in nodes do Decimate j 64
    
    format "time:% heap:%
" (timestamp()-st) (sh-heapfree)
    
    unhide nodes
    
    windows.sendmessage (windows.getMAXHWND()) WM_SETREDRAW 1 0    /* redraw on */
)

Page 2 / 2