home *** CD-ROM | disk | FTP | other *** search
/ Freelog 100 / FreelogNo100-NovembreDecembre2010.iso / Graphisme / GoogleSketchUp / GoogleSketchUpWFR.exe / GoogleSketchUp8.msi / SketchUpMeta.cab / ocean.rb.78D17A5F_0E0A_44D2_877D_2C56D45D16B7 < prev    next >
Encoding:
Text File  |  2010-08-26  |  1.2 KB  |  35 lines

  1. # Copyright 2005-2009, Google, Inc.
  2.  
  3. # This script enables placing a model in Google Earth relative to the ocean floor,
  4. # instead of relative to ground (sea level).
  5.  
  6. # Permission to use, copy, modify, and distribute this software for 
  7. # any purpose and without fee is hereby granted, provided that the above
  8. # copyright notice appear in all copies.
  9.  
  10. # THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
  11. # IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  12. # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  13. #-----------------------------------------------------------------------------
  14.  
  15. def is_on_floor_bottom
  16.   return Sketchup.active_model.get_attribute("GeoReference", "onOceanFloor") == "true";
  17. end
  18.  
  19. def toggle_ocean
  20.   on_floor = !is_on_floor_bottom()
  21.   puts on_floor
  22.   if on_floor
  23.     Sketchup.active_model.set_attribute "GeoReference", "onOceanFloor", on_floor.to_s;
  24.   else
  25.     Sketchup.active_model.attribute_dictionary("GeoReference").delete_key "onOceanFloor";
  26.   end
  27. end
  28.  
  29. menu = UI::menu("Plugins");
  30. menu.add_separator;
  31. item = menu.add_item($oceanStrings.GetString("Model on the Ocean Floor")) { toggle_ocean }
  32. menu.set_validation_proc(item) {
  33.   is_on_floor_bottom() ? MF_CHECKED : MF_UNCHECKED;
  34. }
  35.