Skip to content

Commit

Permalink
Merge pull request #108 from openstudiocoalition/103_stop_flashing
Browse files Browse the repository at this point in the history
103 stop flashing
  • Loading branch information
macumber authored Jun 9, 2022
2 parents 751daf3 + 975e15b commit 2bf49ab
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 14 deletions.
32 changes: 21 additions & 11 deletions plugin/openstudio/lib/MenuManager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,20 @@ def refresh
end
end

def enable_if_model_interface
def enable_if_model_interface(tool = nil)

result = MF_GRAYED
if model_manager = Plugin.model_manager
if model_manager.model_interface
result = MF_ENABLED
if tool
if tool == Sketchup.active_model.tools.active_tool
result = MF_CHECKED
else
result = MF_UNCHECKED
end
else
result = MF_ENABLED
end
end
end

Expand Down Expand Up @@ -236,49 +244,49 @@ def create_commands
@new_space_cmd.large_icon = Plugin.dir + "/lib/resources/icons/OSC_new_space2" + Plugin.image_ext
@new_space_cmd.tooltip = "New Space"
@new_space_cmd.status_bar_text = "Create a new space"
@new_space_cmd.set_validation_proc { enable_if_model_interface }
@new_space_cmd.set_validation_proc { enable_if_model_interface(@new_space_tool) }

@new_shading_surface_group_cmd = UI::Command.new("New Shading Surface Group") { Sketchup.active_model.select_tool(@new_shading_surface_group_tool) }
@new_shading_surface_group_cmd.small_icon = Plugin.dir + "/lib/resources/icons/OSC_new_shading" + Plugin.image_ext
@new_shading_surface_group_cmd.large_icon = Plugin.dir + "/lib/resources/icons/OSC_new_shading" + Plugin.image_ext
@new_shading_surface_group_cmd.tooltip = "New Shading Surface Group"
@new_shading_surface_group_cmd.status_bar_text = "Create a new shading surface group"
@new_shading_surface_group_cmd.set_validation_proc { enable_if_model_interface }
@new_shading_surface_group_cmd.set_validation_proc { enable_if_model_interface(@new_shading_surface_group_tool) }

@new_interior_partition_surface_cmd = UI::Command.new("New Interior Partition Surface Group") { Sketchup.active_model.select_tool(@new_interior_partition_surface_tool) }
@new_interior_partition_surface_cmd.small_icon = Plugin.dir + "/lib/resources/icons/OSC_new_partition" + Plugin.image_ext
@new_interior_partition_surface_cmd.large_icon = Plugin.dir + "/lib/resources/icons/OSC_new_partition" + Plugin.image_ext
@new_interior_partition_surface_cmd.tooltip = "New Interior Partition Surface Group"
@new_interior_partition_surface_cmd.status_bar_text = "Create a new interior partition surface group"
@new_interior_partition_surface_cmd.set_validation_proc { enable_if_model_interface }
@new_interior_partition_surface_cmd.set_validation_proc { enable_if_model_interface(@new_interior_partition_surface_tool) }

@new_daylighting_cmd = UI::Command.new("New Daylighting Control") { Sketchup.active_model.select_tool(@new_daylighting_tool) }
@new_daylighting_cmd.small_icon = Plugin.dir + "/lib/resources/icons/OSC_new_daylighting" + Plugin.image_ext
@new_daylighting_cmd.large_icon = Plugin.dir + "/lib/resources/icons/OSC_new_daylighting" + Plugin.image_ext
@new_daylighting_cmd.tooltip = "New Daylighting Control"
@new_daylighting_cmd.status_bar_text = "Create a new daylighting control"
@new_daylighting_cmd.set_validation_proc { enable_if_model_interface }
@new_daylighting_cmd.set_validation_proc { enable_if_model_interface(@new_daylighting_tool) }

@new_illuminance_cmd = UI::Command.new("New Illuminance Map") { Sketchup.active_model.select_tool(@new_illuminance_tool) }
@new_illuminance_cmd.small_icon = Plugin.dir + "/lib/resources/icons/OSC_new_illuminance" + Plugin.image_ext
@new_illuminance_cmd.large_icon = Plugin.dir + "/lib/resources/icons/OSC_new_illuminance" + Plugin.image_ext
@new_illuminance_cmd.tooltip = "New Illuminance Map"
@new_illuminance_cmd.status_bar_text = "Create a new illuminance map"
@new_illuminance_cmd.set_validation_proc { enable_if_model_interface }
@new_illuminance_cmd.set_validation_proc { enable_if_model_interface(@new_illuminance_tool) }

@new_luminaire_cmd = UI::Command.new("New Luminaire") { Sketchup.active_model.select_tool(@new_luminaire_tool) }
@new_luminaire_cmd.small_icon = Plugin.dir + "/lib/resources/icons/OSC_new_luminaire" + Plugin.image_ext
@new_luminaire_cmd.large_icon = Plugin.dir + "/lib/resources/icons/OSC_new_luminaire" + Plugin.image_ext
@new_luminaire_cmd.tooltip = "New Luminaire"
@new_luminaire_cmd.status_bar_text = "Create a new luminaire"
@new_luminaire_cmd.set_validation_proc { enable_if_model_interface }
@new_luminaire_cmd.set_validation_proc { enable_if_model_interface(@new_luminaire_tool) }

@new_glare_cmd = UI::Command.new("New Glare Sensor") { Sketchup.active_model.select_tool(@new_glare_tool) }
@new_glare_cmd.small_icon = Plugin.dir + "/lib/resources/icons/OSC_new_glare" + Plugin.image_ext
@new_glare_cmd.large_icon = Plugin.dir + "/lib/resources/icons/OSC_new_glare" + Plugin.image_ext
@new_glare_cmd.tooltip = "New Glare Sensor"
@new_glare_cmd.status_bar_text = "Create a new glare sensor"
@new_glare_cmd.set_validation_proc { enable_if_model_interface }
@new_glare_cmd.set_validation_proc { enable_if_model_interface(@new_glare_tool) }

@surface_matching_cmd = UI::Command.new("Surface Matching") { Plugin.dialog_manager.show(SurfaceMatchingInterface) }
@surface_matching_cmd.small_icon = Plugin.dir + "/lib/resources/icons/OSC_surface_matching_selected" + Plugin.image_ext
Expand Down Expand Up @@ -316,7 +324,9 @@ def create_commands
@inspector_dialog_cmd.large_icon = Plugin.dir + "/lib/resources/icons/OSC_inspector" + Plugin.image_ext
@inspector_dialog_cmd.tooltip = "Inspector"
@inspector_dialog_cmd.status_bar_text = "Display and edit the selected object"
@inspector_dialog_cmd.set_validation_proc { Plugin.dialog_manager.validate(PluginInspectorDialog) if (Plugin.dialog_manager) }
@inspector_dialog_cmd.set_validation_proc {
Plugin.dialog_manager.validate(PluginInspectorDialog) if (Plugin.dialog_manager)
}

@surface_search_cmd = UI::Command.new("Surface Search") { Plugin.dialog_manager.show(SurfaceSearchInterface) }
@surface_search_cmd.small_icon = Plugin.dir + "/lib/resources/icons/OSC_surface search" + Plugin.image_ext
Expand All @@ -330,7 +340,7 @@ def create_commands
@info_tool_cmd.large_icon = Plugin.dir + "/lib/resources/icons/OSC_infotool" + Plugin.image_ext
@info_tool_cmd.tooltip = "Info Tool"
@info_tool_cmd.status_bar_text = "Show object data at a glance"
@info_tool_cmd.set_validation_proc { enable_if_model_interface }
@info_tool_cmd.set_validation_proc { enable_if_model_interface(@info_tool) }

@show_errors_cmd = UI::Command.new("Show Errors And Warnings") { Plugin.model_manager.model_interface.show_errors }
@show_errors_cmd.small_icon = Plugin.dir + "/lib/resources/icons/OSC_warning" + Plugin.image_ext
Expand Down
4 changes: 3 additions & 1 deletion plugin/openstudio/lib/PluginManager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def self.current_call_stack
class PluginManager

attr_reader :name, :version, :dir, :image_ext, :profile_running
attr_reader :event_queue
attr_reader :event_queue, :refresh_toolbars
attr_reader :openstudio_application_dir

attr_accessor :model_manager, :command_manager, :menu_manager, :dialog_manager, :animation_manager, :simulation_manager, :preferences
Expand Down Expand Up @@ -303,6 +303,8 @@ def process_events
msg += "It is advised that you save a backup of your current OpenStudio model and restart SketchUp."
UI.messagebox(msg)
elsif @refresh_toolbars
# I don't know why but calling this just once results in the current selected tool flashing
UI.refresh_toolbars
UI.refresh_toolbars
end

Expand Down
7 changes: 5 additions & 2 deletions plugin/openstudio/lib/interfaces/MaterialsInterface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ class MaterialsInterface
attr_reader :space_shading_back, :building_shading_back, :site_shading_back, :interior_partition_surface_back

#for boundary render mode
attr_reader :surface_ext, :adiabatic_ext, :space_ext, :ground_ext, :groundfcfactormethod_ext, :groundslabpreprocessoraverage_ext
attr_reader :surface_ext, :adiabatic_ext, :space_ext, :ground_ext, :foundation_ext, :groundfcfactormethod_ext, :groundslabpreprocessoraverage_ext
attr_reader :groundslabpreprocessorcore_ext, :groundslabpreprocessorperimeter_ext, :groundbasementpreprocessoraveragewall_ext
attr_reader :groundbasementpreprocessoraveragefloor_ext, :groundbasementpreprocessorupperwall_ext, :groundbasementpreprocessorlowerwall_ext
attr_reader :othersidecoefficients_ext, :othersideconditionsmodel_ext
attr_reader :surface_int, :adiabatic_int, :space_int, :outdoors_int, :ground_int, :groundfcfactormethod_int, :groundslabpreprocessoraverage_int
attr_reader :surface_int, :adiabatic_int, :space_int, :outdoors_int, :ground_int, :foundation_int, :groundfcfactormethod_int, :groundslabpreprocessoraverage_int
attr_reader :groundslabpreprocessorcore_int, :groundslabpreprocessorperimeter_int, :groundbasementpreprocessoraveragewall_int
attr_reader :groundbasementpreprocessoraveragefloor_int, :groundbasementpreprocessorupperwall_int, :groundbasementpreprocessorlowerwall_int
attr_reader :othersidecoefficients_int, :othersideconditionsmodel_int
Expand Down Expand Up @@ -136,6 +136,9 @@ def initialize(model_interface)
@ground_ext = get_material("OpenStudio_Ground_Ext", Sketchup::Color.new(204, 183, 122, 1.0))
@ground_int = get_material("OpenStudio_Ground_Int", Sketchup::Color.new(204, 183, 122, 1.0))

@foundation_ext = get_material("OpenStudio_Foundation_Ext", Sketchup::Color.new(117, 30, 122, 1.0))
@foundation_int = get_material("OpenStudio_Foundation_Int", Sketchup::Color.new(117, 30, 122, 1.0))

@groundfcfactormethod_ext = get_material("OpenStudio_Groundfcfactormethod_Ext", Sketchup::Color.new(153, 122, 30, 1.0))
@groundfcfactormethod_int = get_material("OpenStudio_Groundfcfactormethod_Int", Sketchup::Color.new(153, 122, 30, 1.0))

Expand Down
3 changes: 3 additions & 0 deletions plugin/openstudio/lib/interfaces/Surface.rb
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ def paint_boundary(info=nil)
elsif (outsideBoundaryCondition == "GROUND")
@entity.material = @model_interface.materials_interface.ground_ext
@entity.back_material = @model_interface.materials_interface.ground_int
elsif (outsideBoundaryCondition == "FOUNDATION")
@entity.material = @model_interface.materials_interface.foundation_ext
@entity.back_material = @model_interface.materials_interface.foundation_int
elsif (outsideBoundaryCondition == "GROUNDFCFACTORMETHOD")
@entity.material = @model_interface.materials_interface.groundfcfactormethod_ext
@entity.back_material = @model_interface.materials_interface.groundfcfactormethod_int
Expand Down

0 comments on commit 2bf49ab

Please sign in to comment.