Notifications
Clear all

[Closed] Smooth Manager

Hey Guys,

This is a script to manage smooth (Mesh and Turbo) modifiers in the scene. I need feedback on this,

Regards,
Vikram.


global tarObj = #()
global objwithMS = #()
global objwithtrb = #()
rollout general "Target Objects"
(
 radiobuttons genrad1 labels:#("All Objects", "Selected Objects")
 label genlb1 "Script will not work on objects whose" 
 label genlb2 "Smooth modifier names are changed"
 on general open do
 (
  tarObj = #()
  tarObj = $* as array
 )
 
 on genrad1 changed state do 
 (
  if genrad1.state == 1 then 
  (
   tarObj = #()
   tarObj = $* as array
  )
  else if genrad1.state == 2 then
  (
   tarObj = #()
   tarObj = selection as array
  )
  
 ) 
)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
fn msobj = 
(
 objwithMS = for i in tarObj collect if 
 (superclassof i == GeometryClass and classof i != Targetobject and classof i != BoneGeometry and classof i != Biped_Object and i.modifiers[#meshsmooth] != undefined)
 then i else dontcollect
)
fn trbobj = 
(
 objwithTRB = for i in tarObj collect if 
 (superclassof i == GeometryClass and classof i != Targetobject and classof i != BoneGeometry and classof i != Biped_Object and i.modifiers[#turbosmooth] != undefined)
 then i else dontcollect
)

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

rollout mssmooth "MeshSmooth Options"
(
 button msbtn1 "OFF" width:150 pos:[15,5]
 button msbtn2 "ON" width:150 pos:[15,30]
 button msbtn3 "OFF in Viewport" width:150 pos:[15,55]
 spinner msspn1 "Iterations:" range:[0,10,1] type:#integer pos:[39,85]
 label mslb1 "Render Values:" align:#left pos:[16,102]
 checkbox mschk1 "" pos:[15,120]
 spinner msspn2 "Iterations:" range:[0,10,0] type:#integer pos:[39,120] enabled:false
 checkbox mschk2 " Isoline Display" pos:[15,140]
 button msbtn4 "Delete" width:150 pos:[15,160]
  
 
 on msbtn1 pressed do
 (
  
  msobj()
  for i in objwithMS do
  (
  (i.modifiers[#meshsmooth].enabled = false)
  ) 
 )
 on msbtn2 pressed do
 (
  msobj()
  for i in objwithMS do
  (
   i.modifiers[#meshsmooth].enabledinviews = true
   i.modifiers[#meshsmooth].enabled = true
  )
 )
 
 on msbtn3 pressed do
 (
  msobj()
  for i in objwithMS do
  (
   i.modifiers[#meshsmooth].enabled = true
   i.modifiers[#meshsmooth].enabledinviews = false
  )
 )
 
 on msspn1 changed val do
 (
  msobj()
  for i in objwithMS do
  (
  i.modifiers[#MeshSmooth].iterations = msspn1.value
  )
 )
 
 on mschk1 changed theState do
 (
  if mschk1.state == true then
  (
   msspn2.enabled = true
   msobj()
   for i in objwithMS do
   (
	i.modifiers[#MeshSmooth].useRenderIterations = on
   )
  ) 
  else
  (
   msspn2.enabled = false
   msobj()
   for i in objwithMS do
   (
	i.modifiers[#MeshSmooth].useRenderIterations = off
   )
  )
 )
 
 on msspn2 changed theState do
 (
  if mschk1.state == true then
  (
   msobj()
   for i in objwithMS do
   (
	i.modifiers[#MeshSmooth].RenderIterations = msspn2.value
   )
  ) 
 )
 
 on mschk2 changed theState do
 (
  msobj()
  if mschk2.state == true then
  (
   for i in objwithMS do
   (
	i.modifiers[#MeshSmooth].isolineDisplay = on
   )
  )
  else if mschk2.state == false then
  (
   for i in objwithMS do
   (
	i.modifiers[#MeshSmooth].isolineDisplay = off
   )
  ) 
 )
 
 on msbtn4 pressed do
 (
  
  msobj()
  for i in objwithMS do
  (
   deleteModifier i i.modifiers[#MeshSmooth]
  )
 )
 
)
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
rollout trbsmooth "TurboSmooth Options"
(
 button trbbtn1 "OFF" width:150 pos:[15,5]
 button trbbtn2 "ON" width:150 pos:[15,30]
 button trbbtn3 "OFF in Viewport" width:150 pos:[15,55]
 spinner trbspn1 "Iterations:" range:[0,10,1] type:#integer pos:[39,85]
 label trblb1 "Render Values:" align:#left pos:[16,102]
 checkbox trbchk1 "" pos:[15,120]
 spinner trbspn2 "Iterations:" range:[0,10,0] type:#integer pos:[39,120] enabled:false
 checkbox trbchk2 " Isoline Display" pos:[15,140]
 button trbbtn4 "Delete" width:150 pos:[15,160]
 on trbbtn1 pressed do
  (
   trbobj()
   for i in objwithtrb do
   (
   (i.modifiers[#turbosmooth].enabled = false)
   ) 
  )
 
  on trbbtn2 pressed do
  (
   trbobj()
   for i in objwithtrb do
   (
	i.modifiers[#turbosmooth].enabledinviews = true
	i.modifiers[#turbosmooth].enabled = true
   )
  )
  
  on trbbtn3 pressed do
  (
   trbobj()
   for i in objwithtrb do
   (
	i.modifiers[#turbosmooth].enabled = true
	i.modifiers[#turbosmooth].enabledinviews = false
   )
  )
  
  on trbspn1 changed val do
  (
   trbobj()
   for i in objwithtrb do
   (
   i.modifiers[#turboSmooth].iterations = trbspn1.value
   )
  )
  
  on trbchk1 changed theState do
  (
   if trbchk1.state == true then
   (
	trbspn2.enabled = true
	trbobj()
	for i in objwithtrb do
	(
	 i.modifiers[#turboSmooth].useRenderIterations = on
	)
   ) 
   else
   (
	trbspn2.enabled = false
	trbobj()
	for i in objwithtrb do
	(
	 i.modifiers[#turboSmooth].useRenderIterations = off
	)
   )
  )
  
  on trbspn2 changed theState do
  (
   if trbchk1.state == true then
   (
	trbobj()
	for i in objwithtrb do
	(
	 i.modifiers[#turboSmooth].RenderIterations = trbspn2.value
	)
   ) 
  )
  
  on trbchk2 changed theState do
  (
   trbobj()
   if trbchk2.state == true then
   (
	for i in objwithtrb do
	(
	 i.modifiers[#turboSmooth].isolineDisplay = on
	)
   )
   else if trbchk2.state == false then
   (
	for i in objwithtrb do
	(
	 i.modifiers[#turboSmooth].isolineDisplay = off
	)
   ) 
  )
  
  on trbbtn4 pressed do
  (
   
   trbobj()
   for i in objwithtrb do
   (
	deleteModifier i i.modifiers[#turboSmooth]
   )
 
  )
)
rollout abt "About" rolledUp:true
(
label ablb1 "Developed by Vikram Shingrani" 
hyperLink gmail "email : [email="http://forums.cgsociety.org/vshingrani@gmail.com"]vshingrani@gmail.com[/email]" color:(color 0 0 255) address:"[email="http://forums.cgsociety.org/vshingrani@gmail.com"]vshingrani@gmail.com[/email]" align:#center
)
 

  

myfloater = (newRolloutFloater "Smooth Manager" 195 552)
addRollout general myfloater
addRollout mssmooth myfloater
addRollout trbsmooth myfloater
addRollout abt myfloater

1 Reply

I realy love the clean interface.

Thanks for sharing,
blenderman