macroScript SmoothClone category:"Vertex Tools" buttontext:"SmoothClone" tooltip:"SmoothClone" ------------------------------------------------------------------------------- -- "SmoothClone" v1.2 -- 06 March 2003 by Rico Holmes -- www.ricoholmes.com ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Script purpose: -- Workflow automation- Allows the user to edit a low polygon object in -- the left panel while viewing an uncluttered smooth version in the right. -- "on the fly" smoothing level available while in expert mode. ------------------------------------------------------------------------------- ( -- Setup Globals global smref_start global smref_floater global smref_rollout global CurrentlyRunning global RsmoothNamesReserved if RsmoothNamesReserved != 0 and CurrentlyRunning != 1 then ( global RsmoothNamesReserved = 1 global CurrentlyRunning = 0 global Original_Layout = viewport.getLayout () global SmoothRef_Layout = #layout_2v global SM_it = 1 ) if $Original != undefined then global Original_Name = Original_Name if selection.count == 1 then ( if $Original != undefined then Original_Name = Original_Name else global Original_Name = $.name ) --------------------------------------- Rollout Definition -------------------------------------- rollout smref_rollout "SmoothClone V1.2" ( label Smoothonly "Smooth Clone" align:#left across:3 button Run_Rsmooth " " height:19 width:30 offset:[26,-3] tooltip:"Automate modelling Preview" spinner how_smooth "" range:[0,3,1] fieldWidth:20 type:#integer offset:[2,-1] label Resetter "Clear Reference" align:#left across:2 button Reset_Rsmooth " " height:19 width:30 offset:[-11,-3] tooltip:"Clear and Reset Data" ------------------------------------------ Smooth (Normal) -------------------------------------- on Run_Rsmooth pressed do ( -- Check to see if anything is selected if selection.count != 1 then ( MessageBox "Please select an object" title:"SmoothClone v1.2" if $Original != undefined then Original_Name = Original_Name else Original_Name = "Nothing was selected" ) else if $SmoothClone != undefined then ( MessageBox "This script is currently running, press the [Clear Reference] button" title:"SmoothClone v1.2" ) else if CurrentlyRunning == 1 then ( MessageBox "This script is currently running, press the [Clear Reference] button" title:"SmoothClone v1.2" ) else ( CurrentlyRunning = 1 --rename selected if $Original != undefined then Original_Name = Original_Name else ( Original_Name = $.name $.name = "Original" ) --Clone and reposition with name change reference $ isSelected:on name:"SmoothClone" $.pos = [500,50,1000] modPanel.addModToSelection (meshsmooth ()) ui:on $.modifiers[#MeshSmooth].iterations = SM_it --viewport alteration --viewport.resetallviews () viewport.resetallviews () viewport.activeViewport = 1 max vpt persp user viewport.activeViewport = 2 max vpt persp user viewport.setLayout SmoothRef_Layout --Focus on each object viewport.activeViewport = 2 select $SmoothClone max zoomext sel max wire smooth actionMan.executeAction 0 "370" viewport.activeViewport = 1 select $Original viewport.setTM (matrix3 [0.688355,-0.340543,0.640468] [0.725375,0.323163,-0.607781] [0,0.882948,0.469472] [-3.65436,-9.55707,-119.343]) max zoomext sel max wire smooth actionMan.executeAction 0 "369" actionMan.executeAction 0 "370" clearselection() ) ) ------------------------------------Change Smoothness------------------------------------------ on how_smooth changed val do ( SM_it = val if $SmoothClone != undefined then ( select $SmoothClone $.modifiers[#MeshSmooth].iterations = SM_it ) ) ------------------------------------------ Reset Layout -------------------------------------- on Reset_Rsmooth pressed do ( viewport.resetallviews () if $Original != undefined then ( select $Original $.name = Original_Name as string ) if $SmoothClone != undefined then delete $SmoothClone -- User Post Layout viewport.setLayout Original_Layout ---Rico's Post Layout --viewport.activeViewport = 1 --viewport.setLayout #layout_1 --max vpt persp user --max wire smooth --viewport.setTM (matrix3 [0.688355,-0.340543,0.640468] [0.725375,0.323163,-0.607781] [0,0.882948,0.469472] [-3.65436,-9.55707,-119.343]) --max zoomext sel --actionMan.executeAction 0 "370" RsmoothNamesReserved = undefined CurrentlyRunning = 0 ) -------------------------------------------------------------------------------------------------- ) if smref_floater != undefined then CloseRolloutFloater smref_floater smref_floater = newRolloutFloater "SmoothClone V1.2" 190 80 addRollout smref_rollout smref_floater )