I have noticed that the EnableRedraw method will not only redraw the vieports but also seems to be affecting the layers panel. I can see that the selected layer is ‘flickering’ on each redraw. This is distracting and seems to be slowing down the script. I am in a loop with frequent redraw on/off. Would there be any way around this? Is it necessary for redraw to refresh layers panel as well ?
I am still running into this constantly with more of the real-time script usage, when doing constant redraw in a loop, if any of the layers in LayerPanel are selected, the ‘flickering’ effect occurs. I was wondering if it would be OK to add an option to Redraw & EnableRedraw methods not to redraw layer panel?
I know in V6 I can check if layers are selected and possibly deselect them, but it is an extra step in the process and sometimes it is not good to lose the layer selection…
The screen is not really flickering (the viewport I mean), its just showing placing some objects that follow the mouse… but if any layers are selected, the highlighted ones ‘flicker’ randomly, sometimes just every now and then, sometimes constantly - couldn’t pinpoint any rule.
In V5 there is no elegant way to deal with it other than just manually deselecting layers; in V6 - yes, definitely could work with deselecting-reselecting using the new methods, if there is no option not to redraw the layer panel.
I am revisiting this with more usage and testing of V6. The display speed improvement in V6 is phenomenal, but using what I currently have available via scripting I can’t take the full advantage of it. After more testing I can confirm that the Enable/Disable redraw always causes major slowdown compared to just rotating the view with the mouse or changing the view without enable/disable redraw. Obviously the slowdown culprit is redrawing the UI panels. It can be easily tested and compared with a simple box scene, when you have your Properties and Layers panel on (make sure there are some layers visible, the more the slower redraw is).
Here is a simple script that should help with testing this and seeing the difference, which is more than 2x slowdown (sometimes 6x or more slowdown depending on the model and panels content): Redraw_vs_EnableRedraw.rvb (2.2 KB)
Even when working in FullScreen with no panels visible, using EnableRedraw/DisableRedraw is a slowdown compared to no redraw performance.
In most cases in our toolset I need to turn off the redraw because the camera or objects change is not a one-step, but several transformations before the view can be refreshed, so can’t avoid having to enable-disable redraw.
Here comes the wish:
Could we add a method that allows redrawing just the viewport or all viewports, without redrawing the rest of the UI?
Something of what I guess would be an equivalent of RhinoCommon: scriptcontext.doc.Views.Redraw() view = __viewhelper(view) view.Redraw()
Having that would make it possible to take full advantage of the V6 new display speed improvement via RhinoScript, if possible to add to any of the upcoming SRs. Hope you find it a reasonable request.
The EnableRedraw/Redraw difference is clear (maybe my testing code was confusing since I was trying all combinations to see any differences). The visible slowdown is caused no matter if Redraw, EnableRedraw (or unnecessarily both) are used.
Updated Rhino.Redraw will be great to have. So it will basically redraw just viewports if such option is selected, correct? (I can’t tell if any other panels like Properties are also refreshed currently on Redraw…)
Just tested the upgraded Redraw method with False for fast redraw. Something seems off…
There is zero speed gain / difference whether I use old Redraw of the new one with False for views only.
Apart from that, calling Redraw(True or False) seems to be enabling redraw in general.
It shows if you do a few step camera modification (Zoom in the test below). Before it did not behave like that.
Dim nResult, bRedraw, tmStart, tmEnd, i
nResult = Rhino.MessageBox("Enable redraw?", 3 + 32)
Select Case nResult
Case 6 ' Yes
bRedraw = True
Case 7 'No
bRedraw = False
If Not bRedraw Then
tmStart = Timer
For i = 1 To 100
Call Rhino.RotateView(, 0, 10.8)
If Not bRedraw Then
tmEnd = Timer
If Not bRedraw Then
Call Rhino.Print("Elapsed time: " & FormatNumber(tmEnd - tmStart, 2) & " seconds")