Skip to content

Instantly share code, notes, and snippets.

@DSDev-NickHogle
Created February 22, 2012 02:06
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save DSDev-NickHogle/1880643 to your computer and use it in GitHub Desktop.
Save DSDev-NickHogle/1880643 to your computer and use it in GitHub Desktop.
Helps fix the one-frame delay problem when running Google Sketchup in Wine
# Fixes the view each time the view changes
require 'sketchup'
module NH
module ViewFix
class MyViewObserver < Sketchup::ViewObserver
def onViewChanged( view )
puts "View changed: #{view.inspect}"
puts "Invalidating view..."
view.refresh
end
end
def self.fix_view
# Remove old observer
Sketchup.active_model.active_view.remove_observer( @observer ) if @observer
# Attach the observer.
@observer = Sketchup.active_model.active_view.add_observer( MyViewObserver.new )
puts @observer
end
end
end
UI.menu("Plugins").add_item("Fix View") do
NH::ViewFix.fix_view
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment