macroScript pb_WireObject category:"Piranha-Bytes" buttonText:"WireObject" toolTip:"WireObject" ( global toggleObjWireframe local oldSelection = #() local oldMaterials = #() local wireMaterial local _wirecolor = (color 0 0 0) function toggleObjWireframe = ( for o=1 to oldSelection.count do oldSelection[o].material = oldMaterials[o] curSel = getcurrentSelection() oldMaterials = #() for o=1 to curSel.count do append oldMaterials curSel[o].material for o=1 to curSel.count do curSel[o].material = wireMaterial oldSelection = curSel ) rollout ro_ToggleWireframe "pb WireObject" ( checkbutton ui_Wire "Enable" pos:[5,5] width:50 height:20 tooltip:"Enable/Disable WireObject" colorpicker ui_WireColor "Color:" pos:[65,5] fieldwidth:40 height:20 color:_wirecolor title:"Select Wireframe Color" on ui_Wirecolor changed col do ( _wirecolor = col wireMaterial.diffuse = _wireColor ) on ui_wire changed state do ( if state == true do ( oldSelection = getcurrentSelection() oldMaterials = #() for o=1 to oldSelection.count do append oldMaterials oldSelection[o].material toggleObjWireframe() callbacks.addScript #selectionSetChanged "toggleObjWireframe()" id:#toggWire ) if state == false then ( callbacks.removeScripts id:#toggWire for o=1 to oldSelection.count do oldSelection[o].material = oldMaterials[o] ) ) on ro_ToggleWireFrame open do ( callbacks.removeScripts id:#toggWire wireMaterial = StandardMaterial() wireMaterial.name = "WireObject Wirematerial" wireMaterial.wire = true wirematerial.diffuse = _wireColor wirematerial.selfIllumAmount = 100 ) on ro_ToggleWireFrame close do ( callbacks.removeScripts id:#toggWire for o=1 to oldSelection.count do oldSelection[o].material = oldMaterials[o] ) ) createDialog ro_ToggleWireframe width:145 style:#(#style_toolwindow, #style_sysmenu) )