macroScript JoesSelsectionSetFloater category:"Joe's Tools" tooltip:"Floating Selection Set List" ButtonText:"Floating Selection Set List" ( local ini_file = ((getDir #plugcfg) + "\\JoesScripts.ini") global rlt_selset_list rollout rlt_selset_list "" width:192 height:37 ( fn repopulate_list = ( /* Get the names of the selection sets and use them to populate the dropdownlist. */ local selset_names = for selset in selectionSets collect selset for i = 1 to selset_names.count do ( selset_names[i] = selset_names[i] as string selset_names[i] = subString selset_names[i] 14 selset_names[i].count ) sort selset_names rlt_selset_list.ddl_selset_list.items = selset_names ) dropDownList ddl_selset_list "" pos:[8,8] width:180 height:21 on rlt_selset_list open do ( repopulate_list() -- Callbacks to trigger repopulating the list depending on the scene state. callbacks.removeScripts id:#Joes_Selset_List callbacks.addScript #filePostOpen "rlt_selset_list.repopulate_list()" id:#Joes_Selset_List callbacks.addScript #filePostMerge "rlt_selset_list.repopulate_list()" id:#Joes_Selset_List callbacks.addScript #postImport "rlt_selset_list.repopulate_list()" id:#Joes_Selset_List callbacks.addScript #objectXrefPostMerge "rlt_selset_list.repopulate_list()" id:#Joes_Selset_List callbacks.addScript #sceneXrefPostMerge "rlt_selset_list.repopulate_list()" id:#Joes_Selset_List callbacks.addScript #systemPostNew "rlt_selset_list.repopulate_list()" id:#Joes_Selset_List callbacks.addScript #systemPostReset "rlt_selset_list.repopulate_list()" id:#Joes_Selset_List callbacks.addScript #SceneUndo "rlt_selset_list.repopulate_list()" id:#Joes_Selset_List callbacks.addScript #SceneRedo "rlt_selset_list.repopulate_list()" id:#Joes_Selset_List -- Max 9 has some selectionSet specific callbacks. if ((maxVersion())[1] >= 9000) then ( callbacks.addScript #NamedSelSetCreated "rlt_selset_list.repopulate_list()" id:#Joes_Selset_List callbacks.addScript #NamedSelSetDeleted "rlt_selset_list.repopulate_list()" id:#Joes_Selset_List callbacks.addScript #NamedSelSetRenamed "rlt_selset_list.repopulate_list()" id:#Joes_Selset_List ) ) on rlt_selset_list close do ( setINISetting ini_file "selset_list" "dialog_pos" ((getDialogPos rlt_selset_list) as string) callbacks.removeScripts id:#Joes_Selset_List ) on ddl_selset_list selected list_index do ( local selset_name = ddl_selset_list.items[list_index] clearSelection() for selset_obj in selectionSets[selset_name] do ( selectMore selset_obj ) ) ) -- Open the window at the location it was at when it was closed. If there -- is no saved position open it at the center of the screen. local dialog_size = [192, 37] local point_string = (getINISetting ini_file "selset_list" "dialog_pos") as stringStream try ( seek point_string 0 local dialog_pos = readValue point_string ) catch ( local dialog_pos = ((getMaxWindowSize() / 2) - (dialog_size / 2)) ) createDialog rlt_selset_list \ pos:dialog_pos \ width:dialog_size.x \ height:dialog_size.y \ lockHeight:true \ lockWidth:true \ style:#(#style_titlebar,#style_toolwindow, #style_sysmenu) )