View.invalidate vs view.refresh
-
What is the difference?
View.invalidate
http://code.google.com/apis/sketchup/docs/ourdoc/view.html#invalidate@unknownuser said:
The invalidate method is used to refresh the view.
View.refresh
http://code.google.com/apis/sketchup/docs/ourdoc/view.html#refresh@unknownuser said:
The refresh method is used to immediately refresh the view.
http://code.google.com/apis/sketchup/docs/releases.html
@unknownuser said:
Force refresh of a view. More powerful that view.invalidate because it refreshes immediately.
I'm really none the wiser from these descriptions.
-
Well, the first method is backwardly compatible, but the second one is a v7 onwards tool.
I think that the first only updates the view outside of the start/commit block but the second updates the view straightaway - which could be useful if you want to show a user where they are up to - if you are inside a start/commit block with its 'flag' set 'true' [v7] the view isn't updated inside it...
I avoid the second to keep v6+v7 compatibility as many haven't come over to the 'light-side' yet -
Yea - I try to keep to SU6 methods, but there are some of my plugins that require SU7+ methods with no way around it.
Really wish there was a clear example for these two methods of refreshing...
-
Scott said that it will refresh the view even if there seems to be nothing to refresh, whereas invalidate will not....? But that never made sense to me entirely. I think it was put in place for dynamic components, but I'm not exactly sure why.
Chris
-
Sounds like we might need to give Scott a prod...
-
I am thinking that maybe if you are moving geometry by increments, it will not show that movement with invalidate. BUT if you use refresh, then it will show it. In that sense, I think it is tied in with what TIG suggested about it working even inside a single start/commit call. So you can use it to anmiate the movement of geometry, without having to set up a true animation object.
I probably should have tested that before I said it, but oh well. I'll go try to test it right now.
Chris
-
-
But that is done with an animation class, right? I was thinking maybe moving things that do not use the animation class would need it. But again, I'm probably wrong. I have not tried this, my computer has been tied up rendering artsy shadows for the seasonal changes over the course of a year.
Advertisement