AWS Thinkbox Discussion Forums

Frost MaxScript Utility

id like to create a lil frost maxscript UI, which lets me control frost in the scenes quickly, without having to select the frost
it would let me turn on -off in viewport, let me change things like radius, a seperate UI that can be open anytime

how i can access the frost values through maxscript, is there any way?

what id like to know is

-select frost01, frost02, etc.
-turn on/off viewport
-change radius
-blend radius (if zhubridson is on)

to keep it simple for now

any help is appreciated!

Create a teapot, create a Frost out of it, then type in the Listener “show $”

show $ .showIcon : boolean .iconSize : worldUnits .updateOnFrostChange : boolean .updateOnParticleChange : boolean .nodeList : node array .pfEventList : node array .fileList : string array .loadSingleFrame : boolean .frameOffset : integer .limitToRange : boolean .rangeStartFrame : integer .rangeEndFrame : integer .enablePlaybackGraph : boolean .playbackGraphTime : float .beforeRangeBehavior : integer .afterRangeBehavior : integer .fileLengthUnit : integer .fileCustomScale : float .meshingMethod : integer .enableRenderMesh : boolean .enableViewportMesh : boolean .radius : worldUnits .useRadiusChannel : boolean .randomizeRadius : boolean .radiusRandomVariation : float .radiusRandomSeed : integer .motionBlurMode : integer .renderUsingViewportSettings : boolean .renderMeshingResolution : float .renderVertRefinementIterations : integer .viewportMeshingResolution : float .viewportVertRefinementIterations : integer .metaballRadiusScale : float .metaballIsosurfaceLevel : float .zhuBridsonBlendRadiusScale : float .zhuBridsonEnableLowDensityTrimming : boolean .zhuBridsonLowDensityTrimmingThreshold : float .zhuBridsonLowDensityTrimmingStrength : float .geometryType : integer .geometryList : node array .geometrySelectionMode : integer .geometrySelectionSeed : integer .geometrySampleTimeOffsetMode : integer .geometrySampleTimeMaxRandomOffset : float .geometrySampleTimeSeed : integer .geometryOrientationMode : integer .geometryOrientationLookAtNode : node .geometryOrientationVectorChannel : string .geometryOrientationX : float .geometryOrientationY : float .geometryOrientationZ : float .geometryOrientationDivergence : float .geometryOrientationRestrictDivergenceAxis : boolean .geometryOrientationDivergenceAxisSpace : integer .geometryOrientationDivergenceAxisX : float .geometryOrientationDivergenceAxisY (geometryOrientationDivergenceAxisX) : float .geometryOrientationDivergenceAxisZ : float .writeVelocityMapChannel : boolean .velocityMapChannel : integer .viewportLoadMode : integer .viewportLoadPercent : float .anisotropicRadiusScale : float .anisotropicWindowScale : float .anisotropicIsosurfaceLevel : float .anisotropicMaxAnisotropy : float .anisotropicMinNeighborCount : integer .anisotropicPositionSmoothingWindowScale : float .anisotropicPositionSmoothingWeight : float .pfEventFilterMode : integer .materialMode : integer .undefinedMaterialID : integer .geometryMaterialIDNodeList : node array .geometryMaterialIDInList : index array .geometryMaterialIDOutList : index array .radiusScale (Radius_Scale) : float .radiusAnimationMode : integer .enableRadiusScale : boolean .geometrySampleTimeBaseMode : integer .nodeListFlags : int array .fileListFlags : int array .meshingResolutionMode : integer .renderVoxelLength : worldUnits .viewportVoxelLength : worldUnits .iconMode : integer .viewRenderParticles : integer .tpGroupFilterMode : integer .tpGroupList : maxObject array false

These are all parameters that can be accessed in a Frost object.

A Frost object has a base object of class “Frost”. So, in order to collect all Frost objects in the scene, you can say

theFrosts = for o in objects where classof o.baseobject == Frost collect o

You could then create a small dialog with a drop-down list to select the Frost you want to work on, or even a multi-list box to select multiple at once and change all their settings or select them in the scene (like the Krakatoa Explorers).

Here is a starting point for further enhancements:

macroScript FrostExplorer category:"Frost"
(
	global Frost_Explorer_Dialog 
	try(destroyDialog Frost_Explorer_Dialog)catch()
	
	rollout Frost_Explorer_Dialog  "FROST Explorer"
	(
		local theFrosts = #()
		multilistbox lbx_frostObjects "Frost Objects in the Scene:"
		
		checkbox chk_onInVpt "Enable In Viewport" across:2 
		spinner spn_radius "Particle Radius:" range:[0,10000,5.0] fieldwidth:40 type:#worldunits
		spinner spn_blendRadius "ZB Blend Radius:" range:[0,100,1.7] fieldwidth:40 type:#float
		
		fn getSelectedFrosts = 
		(
			(for i in lbx_frostObjects.selection collect theFrosts[i])
		)
		
		fn updateControls =
		(
			local theSelectedFrosts = getSelectedFrosts()
			local enableInViewport = 0
			local particleRadius = 0
			local blendRadius = 0
			for o in theSelectedFrosts do
			(
				if o.enableViewportMesh do  enableInViewport+=1
				if o.Radius > particleRadius do particleRadius = o.Radius
				if o.zhuBridsonBlendRadiusScale  > blendRadius do blendRadius = o.zhuBridsonBlendRadiusScale  
			)
			chk_onInVpt.triState = case of
			(
				(enableInViewport == theSelectedFrosts.count) :  1
				(enableInViewport == 0) : 0
				default: 2
			)
			spn_radius.value = particleRadius
			spn_blendRadius.value = blendRadius
		)
		
		on spn_radius changed val do
		(
			for o in getSelectedFrosts() do o.Radius = val
		)
		on spn_blendRadius changed val do
		(
			for o in getSelectedFrosts() do o.zhuBridsonBlendRadiusScale  = val
		)
		on chk_onInVpt changed state do
		(
			for o in getSelectedFrosts() do o.enableViewportMesh = state
			updateControls()
		)
		
		on lbx_frostObjects selected itm do
		(
			local theSel = lbx_frostObjects.selection as array
			if theSel.count == 0 then 
				max select none 
			else
				select (for i in theSel collect theFrosts[i])
			updateControls()
		)
		
		on Frost_Explorer_Dialog open do
		(
			theFrosts = for o in objects where classof o.baseobject == Frost collect o
			lbx_frostObjects.items = for o in theFrosts collect o.name	
		)
	)
	
	createDialog Frost_Explorer_Dialog 300 210
)

By jove, jolly good idea, instead of loosing track of Frost (especially when you drop a mod on it) have a always up HUD. hmmm :slight_smile:

I haven’t checked, is Frost fully mxs exposed? :smiley: :blush: :laughing:

wow thanks Bobo,

i did not know the show variable commanD!

thanks for starting out, would have not been able to make a nice utility like that, learned some maxscript while adding some more options!

  
   global Frost_Explorer_Dialog 
   try(destroyDialog Frost_Explorer_Dialog)catch()
   
   rollout Frost_Explorer_Dialog  "FROST Explorer"
   (
      local theFrosts = #()
      multilistbox lbx_frostObjects "Frost Objects in the Scene:" height:6
      
      checkbox chk_onInVpt "View"  align:#right across:3
	   checkbox chk_onInVpt2 "Rndr"  align:#right
	   checkbox chk_onUpdate "Rfrsh"  align:#right
	   
	  label lbl_space ""
	   spinner spn_mesh "Mesh Type:" range:[1,6,3] fieldwidth:40 type:#integer align:#right
      spinner spn_radius "Particle Radius:" range:[0,10000,5.0] fieldwidth:40 type:#worldunits align:#right
      spinner spn_blendRadius "ZB Blend Radius:" range:[0,100,1.7] fieldwidth:40 type:#float align:#right
	   label lbl_space2 ""
	    spinner spn_ATsurface "AT Surface Level:" range:[0,100,0.5] fieldwidth:40 type:#float align:#right
	    spinner spn_ATstretch "AT Stretch:" range:[0,100,4] fieldwidth:40 type:#float align:#right
	    spinner spn_ATneighbors "AT Neighbors:" range:[0,100,25] fieldwidth:40 type:#integer align:#right
	    spinner spn_ATsmoothing "AT Smoothing:" range:[0,100,0.9] fieldwidth:40 type:#float align:#right
	   label lbl_space3 ""
	   spinner spn_render "Render Resolution:" range:[0,100,1.7] fieldwidth:40 type:#float align:#right
	   spinner spn_viewport "Viewport Resolution:" range:[0,100,1.7] fieldwidth:40 type:#float align:#right
	    
      
      fn getSelectedFrosts = 
      (
         (for i in lbx_frostObjects.selection collect theFrosts[i])
      )
      
      fn updateControls =
      (
         local theSelectedFrosts = getSelectedFrosts()
         local enableInViewport = 0
		  local enableInRender = 0
		  local updateOnParticleChange = 0
		  
         local particleRadius = 0
         local blendRadius = 0
		 local meshingType = 0
		  local anisotropicIsosurfaceLevel = 0
		  local anisotropicMaxAnisotropy = 0
		  local anisotropicMinNeighborCount = 0
		  local anisotropicPositionSmoothingWindowScale = 0
		   local renderMeshingResolution = 0
		   local viewportMeshingResolution = 0
		   
		  
         for o in theSelectedFrosts do
         (
            if o.enableViewportMesh do  enableInViewport+=1
			if o.enableRenderMesh do  enableInRender+=1
			if o.updateOnParticleChange do  updateOnParticleChange +=1	
			if o.meshingMethod > meshingType do meshingType = o.meshingMethod
            if o.Radius > particleRadius do particleRadius = o.Radius
            if o.zhuBridsonBlendRadiusScale  > blendRadius do blendRadius = o.zhuBridsonBlendRadiusScale 
			if o.anisotropicIsosurfaceLevel  > anisotropicIsosurfaceLevel do anisotropicIsosurfaceLevel = o.anisotropicIsosurfaceLevel
			if o.anisotropicMaxAnisotropy  > anisotropicMaxAnisotropy do anisotropicMaxAnisotropy = o.meshingMethod
			if o.anisotropicMinNeighborCount  > anisotropicMinNeighborCount do anisotropicMinNeighborCount = o.anisotropicMinNeighborCount
			if o.anisotropicPositionSmoothingWindowScale  > anisotropicPositionSmoothingWindowScale do anisotropicPositionSmoothingWindowScale = o.anisotropicPositionSmoothingWindowScale
			if o.renderMeshingResolution  > renderMeshingResolution do renderMeshingResolution = o.renderMeshingResolution
			if o.viewportMeshingResolution  > viewportMeshingResolution do viewportMeshingResolution = o.viewportMeshingResolution
			
         )
         chk_onInVpt.triState = case of
         (
            (enableInViewport == theSelectedFrosts.count) :  1
            (enableInViewport == 0) : 0
            default: 2
         )
		  chk_onInVpt2.triState = case of
         (
            (enableInRender == theSelectedFrosts.count) :  1
            (enableInRender == 0) : 0
            default: 2
         )
		 
		  chk_onUpdate.triState = case of
         (
            (updateOnParticleChange == theSelectedFrosts.count) :  1
            (updateOnParticleChange == 0) : 0
            default: 2
         )
		 
		 spn_mesh.value = meshingType
         spn_radius.value = particleRadius
         spn_blendRadius.value = blendRadius
		 spn_ATsurface.value = anisotropicIsosurfaceLevel
		 spn_ATstretch.value = anisotropicMaxAnisotropy
		 spn_ATneighbors.value = anisotropicMinNeighborCount
		 spn_ATsmoothing.value = anisotropicPositionSmoothingWindowScale
		 spn_render.value = renderMeshingResolution
		 spn_viewport.value = viewportMeshingResolution
		 
      )
	  
	  
	  
	   on chk_onInVpt changed state do
      (
         for o in getSelectedFrosts() do o.enableViewportMesh = state
         updateControls()
      )
	    on chk_onInVpt2 changed state do
      (
         for o in getSelectedFrosts() do o.enableRenderMesh = state
         updateControls()
      )
	     on chk_onUpdate changed state do
      (
         for o in getSelectedFrosts() do o.updateOnParticleChange = state
         updateControls()
      )
	  
      on spn_mesh changed val do
      (
         for o in getSelectedFrosts() do o.meshingMethod = val
      )
      on spn_radius changed val do
      (
         for o in getSelectedFrosts() do o.Radius = val
      )
      on spn_blendRadius changed val do
      (
         for o in getSelectedFrosts() do o.zhuBridsonBlendRadiusScale  = val
      )
	  
	   on spn_spn_ATsurface changed val do
      (
         for o in getSelectedFrosts() do o.anisotropicIsosurfaceLevel  = val
      )
     on spn_spn_ATstretch changed val do
      (
         for o in getSelectedFrosts() do o.anisotropicMaxAnisotropy  = val
      )
	  on spn_spn_ATneighbor changed val do
      (
         for o in getSelectedFrosts() do o.anisotropicMinNeighborCount  = val
      )
	   
	  on spn_spn_ATsmoothing changed val do
      (
         for o in getSelectedFrosts() do o.anisotropicPositionSmoothingWindowScale  = val
      )
	  
	  on spn_viewport changed val do
      (
	 
         for o in getSelectedFrosts() do o.viewportMeshingResolution  = val
      )
	  
	 on spn_render changed val do
      (
         for o in getSelectedFrosts() do o.renderMeshingResolution  = val
      )
	  
	  
	  
      
      on lbx_frostObjects selected itm do
      (
         local theSel = lbx_frostObjects.selection as array
         if theSel.count == 0 then 
            max select none 
         else
            select (for i in theSel collect theFrosts[i])
         updateControls()
      )
      
	  
	  
      on Frost_Explorer_Dialog open do
      (
         theFrosts = for o in objects where classof o.baseobject == Frost collect o
         lbx_frostObjects.items = for o in theFrosts collect o.name   
      )
	  
	  
   )
   
   createDialog Frost_Explorer_Dialog 170 380

hmm the anisotropic spinners update correctly but dont affect the frost when changing

In the script, search for “spn_spn_” and replace it with “spn_”. It’s in four places.

hah, cant believe i missed that

thanks paul :slight_smile:

this utility is turning out to be quite useful, especially for scenes with 8frost objects!

id like to add a button that makes a low poly (viewport res) frost proxy,

so all it would do is clone the frost and turn it into edit mesh,

i know how to clone, how would i - convert to edit mesh with maxscript?

Something along the lines of

theClone = copy theFrost convertToMesh theClone

Having written a lot of MEL code this week, I find new appreciation for the clarity of MAXScript expressions :mrgreen:

ah just found it
sel = getCurrentSelection()
convertToMesh sel

ok ill try that with copy now

hah, i wish it was clear to me

battling to make this silly proxy button for the last hour!

i grabbed some code from my v-motion scripts, and made it a lot more complicated than it should be :slight_smile:

i managed to make it work, only that it makes the original frost the edit mesh, and creates a copy of this, not so good

   global Frost_Explorer_Dialog 
   try(destroyDialog Frost_Explorer_Dialog)catch()




	
   rollout Frost_Explorer_Dialog  "FROST Explorer"
   (
	   
			local cloneCollection
			
			fn CloneAndSelect objArray type = (
			currObjs = objects.count
			case type of (
				1: copy objArray
				2: instance objArray
				3: reference objArray
			)
			newObjs = for i = (currObjs+0) to objects.count collect objects[i]
			select newObjs
					)
					
					
      local theFrosts = #()
      multilistbox lbx_frostObjects "Frost Objects in the Scene:" height:10
      
      checkbox chk_onInVpt "View"  align:#right across:3
	   checkbox chk_onInVpt2 "Rndr"  align:#right
	   checkbox chk_onUpdate "Rfrsh"  align:#right
	   
	  label lbl_space ""
	   spinner spn_mesh "Mesh Type:" range:[1,6,3] fieldwidth:40 type:#integer align:#right
      spinner spn_radius "Particle Radius:" range:[0,10000,5.0] fieldwidth:40 type:#worldunits align:#right
      spinner spn_blendRadius "ZB Blend Radius:" range:[0,100,1.7] fieldwidth:40 type:#float align:#right
	   label lbl_space2 ""
	    spinner spn_ATscale "AT Scale Radius:" range:[0,100,0.5] fieldwidth:40 type:#float align:#right
	    spinner spn_ATsurface "AT Surface Level:" range:[0,100,0.5] fieldwidth:40 type:#float align:#right
	    spinner spn_ATstretch "AT Stretch:" range:[0,100,4] fieldwidth:40 type:#float align:#right
	    spinner spn_ATneighbors "AT Neighbors:" range:[0,100,25] fieldwidth:40 type:#integer align:#right
	    spinner spn_ATsmoothing "AT Smoothing:" range:[0,100,0.9] fieldwidth:40 type:#float align:#right
	   label lbl_space3 ""
	   spinner spn_render "Render Resolution:" range:[0,100,1.7] fieldwidth:40 type:#float align:#right
	   spinner spn_viewport "Viewport Resolution:" range:[0,100,1.7] fieldwidth:40 type:#float align:#right
	    --spinner objCount "" range:[1,10000,50] type:#integer   width:42	 toolTip:"Proxy Count" across:3 align:#left
		--radiobuttons clonetype labels:#("C","I","R") align:#left across:2 width:200    default:2 
		button btnProxy "Proxy" align:#right width:60 height:38 toolTip:"Create Frost Proxies"
      
      fn getSelectedFrosts = 
      (
         (for i in lbx_frostObjects.selection collect theFrosts[i])
      )
      
      fn updateControls =
      (
         local theSelectedFrosts = getSelectedFrosts()
         local enableInViewport = 0
		  local enableInRender = 0
		  local updateOnParticleChange = 0
		  
         local particleRadius = 0
         local blendRadius = 0
		 local meshingType = 0
		  local scale1 = 0
		  local surface1 = 0
		  local stretch1 = 0
		  local neighbor = 0
		  local smoothing = 0
		   local renderMeshingResolution = 0
		   local viewportMeshingResolution = 0
		   
		  
         for o in theSelectedFrosts do
         (
            if o.enableViewportMesh do  enableInViewport+=1
			if o.enableRenderMesh do  enableInRender+=1
			if o.updateOnParticleChange do  updateOnParticleChange +=1	
			if o.meshingMethod > meshingType do meshingType = o.meshingMethod
            if o.Radius > particleRadius do particleRadius = o.Radius
            if o.zhuBridsonBlendRadiusScale  > blendRadius do blendRadius = o.zhuBridsonBlendRadiusScale 
			if o.anisotropicRadiusScale > scale1 do scale1 = o.anisotropicRadiusScale
			if o.anisotropicIsosurfaceLevel  > surface1 do surface1 = o.anisotropicIsosurfaceLevel
			if o.anisotropicMaxAnisotropy  > stretch1 do stretch1 = o.anisotropicMaxAnisotropy
			if o.anisotropicMinNeighborCount  > neighbor do neighbor = o.anisotropicMinNeighborCount
			if o.anisotropicPositionSmoothingWindowScale  > smoothing do smoothing = o.anisotropicPositionSmoothingWindowScale
			if o.renderMeshingResolution  > renderMeshingResolution do renderMeshingResolution = o.renderMeshingResolution
			if o.viewportMeshingResolution  > viewportMeshingResolution do viewportMeshingResolution = o.viewportMeshingResolution
			
         )
         chk_onInVpt.triState = case of
         (
            (enableInViewport == theSelectedFrosts.count) :  1
            (enableInViewport == 0) : 0
            default: 2
         )
		  chk_onInVpt2.triState = case of
         (
            (enableInRender == theSelectedFrosts.count) :  1
            (enableInRender == 0) : 0
            default: 2
         )
		 
		  chk_onUpdate.triState = case of
         (
            (updateOnParticleChange == theSelectedFrosts.count) :  1
            (updateOnParticleChange == 0) : 0
            default: 2
         )
		 
		 spn_mesh.value = meshingType
         spn_radius.value = particleRadius
         spn_blendRadius.value = blendRadius
		 spn_ATradiusScale.value = scale1
		 spn_ATsurface.value = surface1
		 spn_ATstretch.value = stretch1
		 spn_ATneighbors.value = neighbor
		 spn_ATsmoothing.value = smoothing
		 spn_render.value = renderMeshingResolution
		 spn_viewport.value = viewportMeshingResolution
		 
		 
		   
      )
	  
	  

	
	
	   on chk_onInVpt changed state do
      (
         for o in getSelectedFrosts() do o.enableViewportMesh = state
         updateControls()
      )
	    on chk_onInVpt2 changed state do
      (
         for o in getSelectedFrosts() do o.enableRenderMesh = state
         updateControls()
      )
	     on chk_onUpdate changed state do
      (
         for o in getSelectedFrosts() do o.updateOnParticleChange = state
         updateControls()
      )
	  
      on spn_mesh changed val do
      (
         for o in getSelectedFrosts() do o.meshingMethod = val
      )
      on spn_radius changed val do
      (
         for o in getSelectedFrosts() do o.Radius = val
      )
      on spn_blendRadius changed val do
      (
         for o in getSelectedFrosts() do o.zhuBridsonBlendRadiusScale  = val
      )
	   on spn_ATscale changed val do
      (
         for o in getSelectedFrosts() do o.anisotropicRadiusScale  = val
      )
	   on spn_ATsurface changed val do
      (
         for o in getSelectedFrosts() do o.anisotropicIsosurfaceLevel  = val
      )
     on spn_ATstretch changed val do
      (
         for o in getSelectedFrosts() do o.anisotropicMaxAnisotropy  = val
      )
	  on spn_ATneighbors changed val do
      (
         for o in getSelectedFrosts() do o.anisotropicMinNeighborCount  = val
      )
	   
	  on spn_ATsmoothing changed val do
      (
         for o in getSelectedFrosts() do o.anisotropicPositionSmoothingWindowScale  = val
      )
	  
	  on spn_viewport changed val do
      (
	 
         for o in getSelectedFrosts() do o.viewportMeshingResolution  = val
      )
	  
	 on spn_render changed val do
      (
         for o in getSelectedFrosts() do o.renderMeshingResolution  = val
      )
	  
	  
	  
      
      on lbx_frostObjects selected itm do
      (
         local theSel = lbx_frostObjects.selection as array
         if theSel.count == 0 then 
            max select none 
         else
            select (for i in theSel collect theFrosts[i])
         updateControls()
      )
      
	  
	  
      on Frost_Explorer_Dialog open do
      (
         theFrosts = for o in objects where classof o.baseobject == Frost collect o
         lbx_frostObjects.items = for o in theFrosts collect o.name   
      )
	  on btnProxy pressed Do 
	(
		objs = selection as array
			if objs.count > 0 do
			(
			num = 3
			type = 1
			objArray = #()
			for c = 2 to (num-1) do (
				CloneAndSelect objs type
				join objArray objs  --(getCurrentSelection())
					
			)
			--insertItem objs objArray 1
			--select objArray
			convertToMesh objArray
			)
		--cloneCollection = objArray
			--select objArray
	)
	
	  
   )
   
   createDialog Frost_Explorer_Dialog 170 500

this the new frost explorer

and here is the code i had to produce to get it working! :smiley:

[code]local cloneCollection

		fn CloneAndSelect objArray type = (
		currObjs = objects.count
		case type of (
			1: copy objArray
			2: instance objArray
			3: reference objArray
		)
		newObjs = for i = (currObjs+0) to objects.count collect objects[i]
		select newObjs
				)[/code]

--spinner objCount "" range:[1,10000,50] type:#integer width:42 toolTip:"Proxy Count" across:3 align:#left --radiobuttons clonetype labels:#("C","I","R") align:#left across:2 width:200 default:2 button btnProxy "Proxy" align:#right width:60 height:38 toolTip:"Create Frost Proxies"

[code] on btnProxy pressed Do
(
objs = selection as array
if objs.count > 0 do
(
num = 3
type = 1
objArray = #()
for c = 2 to (num-1) do (
CloneAndSelect objs type
join objArray objs --(getCurrentSelection())

		)
		--insertItem objs objArray 1
		--select objArray
		convertToMesh objArray
		)
	--cloneCollection = objArray
		--select objArray
)

)[/code]

i can hear you laughing already :laughing:

(
global Frost_Explorer_Dialog 
try(destroyDialog Frost_Explorer_Dialog)catch()
   
rollout Frost_Explorer_Dialog  "FROST Explorer"
(
	local theFrosts = #()
    multilistbox lbx_frostObjects "Frost Objects in the Scene:" height:10 width:170 align:#center
      
    checkbox chk_onInVpt "View"  align:#right across:3
    checkbox chk_onInVpt2 "Rndr"  align:#right
    checkbox chk_onUpdate "Rfrsh"  align:#right
      
	group "Meshing Controls"
	(
		dropdownlist ddl_mesh items:#("Geometry","Union Of Spheres","Metaballs","Zhu/Bridson","Vertex Cloud","Anisotropic","<Multiple Selected>","<None Selected>") width:150 align:#center tooltip:"Meshing Mode" selection:8
		spinner spn_radius "Particle Radius:" range:[0,10000,5.0] fieldwidth:40 type:#worldunits align:#right
	)
	group "Zhu/Bridson Meshing"
	(
		spinner spn_blendRadius "Blend Radius:" range:[0,100,1.7] fieldwidth:40 type:#float align:#right
	)
	group "Anistotropic Meshing"
	(
		spinner spn_ATradiusScale "Radius Scale:" range:[0,100,0.5] fieldwidth:40 type:#float align:#right
		spinner spn_ATsurface "Surface Level:" range:[0,100,0.5] fieldwidth:40 type:#float align:#right
		spinner spn_ATstretch "Max.Stretch:" range:[0,100,4] fieldwidth:40 type:#float align:#right
		spinner spn_ATneighbors "Min.Neighbors:" range:[0,100,25] fieldwidth:40 type:#integer align:#right
		spinner spn_ATsmoothing "Pos.Smoothing:" range:[0,1,0.9] fieldwidth:40 type:#float align:#right
	)
	group "Mesh Resolution"
	(
		spinner spn_render "Render Resolution:" range:[0,100,1.7] fieldwidth:40 type:#float align:#right
		spinner spn_viewport "Viewport Resolution:" range:[0,100,1.7] fieldwidth:40 type:#float align:#right
	)
	button btn_Proxy "Create Proxy" align:#right width:80 height:30 toolTip:"Create Frost Proxies"
      
	fn getSelectedFrosts = 
	(
		(for i in lbx_frostObjects.selection collect theFrosts[i])
	)
      
	fn updateControls =
	(
		local theSelectedFrosts = getSelectedFrosts()
		local enableInViewport = 0
		local enableInRender = 0
		local updateOnParticleChange = 0
        
		local particleRadius = 0
		local blendRadius = 0
		local meshingTypes = #() --collect all meshing types
		local scale1 = 0
		local surface1 = 0
		local stretch1 = 0
		local neighbor = 0
		local smoothing = 0
		local renderMeshingResolution = 0
		local viewportMeshingResolution = 0
        
		for o in theSelectedFrosts do
		(
			if o.enableViewportMesh do  enableInViewport+=1
			if o.enableRenderMesh do  enableInRender+=1
			if o.updateOnParticleChange do  updateOnParticleChange +=1   
			appendIfUnique meshingTypes o.meshingMethod  --collect only if not on the list yet
			if o.Radius > particleRadius do particleRadius = o.Radius
			if o.zhuBridsonBlendRadiusScale  > blendRadius do blendRadius = o.zhuBridsonBlendRadiusScale 
			if o.anisotropicRadiusScale > scale1 do scale1 = o.anisotropicRadiusScale
			if o.anisotropicIsosurfaceLevel  > surface1 do surface1 = o.anisotropicIsosurfaceLevel
			if o.anisotropicMaxAnisotropy  > stretch1 do stretch1 = o.anisotropicMaxAnisotropy
			if o.anisotropicMinNeighborCount  > neighbor do neighbor = o.anisotropicMinNeighborCount
			if o.anisotropicPositionSmoothingWeight  > smoothing do smoothing = o.anisotropicPositionSmoothingWeight
			if o.renderMeshingResolution  > renderMeshingResolution do renderMeshingResolution = o.renderMeshingResolution
			if o.viewportMeshingResolution  > viewportMeshingResolution do viewportMeshingResolution = o.viewportMeshingResolution
		)
		chk_onInVpt.triState = case of
		(
			(enableInViewport == theSelectedFrosts.count) :  1
			(enableInViewport == 0) : 0
			default: 2
		)
		chk_onInVpt2.triState = case of
		(
			(enableInRender == theSelectedFrosts.count) :  1
			(enableInRender == 0) : 0
			default: 2
		)
       
		chk_onUpdate.triState = case of
		(
			(updateOnParticleChange == theSelectedFrosts.count) :  1
			(updateOnParticleChange == 0) : 0
			default: 2
		)
       
		ddl_mesh.selection = case of 
		(
			(meshingTypes.count == 1): meshingTypes[1] --if only one collected, all have the same mode
			(meshingTypes.count > 1): 7 --if more than one collected, there were different modes
			default: 8 --if nothing collected, nothing was selected
		)
		spn_radius.value = particleRadius
		spn_blendRadius.value = blendRadius
		spn_ATradiusScale.value = scale1
		spn_ATsurface.value = surface1
		spn_ATstretch.value = stretch1
		spn_ATneighbors.value = neighbor
		spn_ATsmoothing.value = smoothing
		spn_render.value = renderMeshingResolution
		spn_viewport.value = viewportMeshingResolution
	)
   
	on chk_onInVpt changed state do
	(
		for o in getSelectedFrosts() do o.enableViewportMesh = state
		updateControls()
	)
	on chk_onInVpt2 changed state do
	(
		for o in getSelectedFrosts() do o.enableRenderMesh = state
		updateControls()
	)
	on chk_onUpdate changed state do
	(
		for o in getSelectedFrosts() do o.updateOnParticleChange = state
		updateControls()
	)
     
	on ddl_mesh selected val do
	(
		if val < 7 then --if a valid mode was selected, apply it
			for o in getSelectedFrosts() do o.meshingMethod = val
		else
			updateControls() --otherwise reset the controls to prevent the user from selecting <multi> or <none>
	)
	on spn_radius changed val do
	(
		for o in getSelectedFrosts() do o.Radius = val
	)
	on spn_blendRadius changed val do
	(
		for o in getSelectedFrosts() do o.zhuBridsonBlendRadiusScale  = val
	)
	on spn_ATradiusScale changed val do
	(
		for o in getSelectedFrosts() do o.anisotropicRadiusScale  = val
	)
	on spn_ATsurface changed val do
	(
		for o in getSelectedFrosts() do o.anisotropicIsosurfaceLevel  = val
	)
	on spn_ATstretch changed val do
	(
		for o in getSelectedFrosts() do o.anisotropicMaxAnisotropy  = val
	)
	on spn_ATneighbors changed val do
	(
		for o in getSelectedFrosts() do o.anisotropicMinNeighborCount  = val
	)
	on spn_ATsmoothing changed val do
	(
		for o in getSelectedFrosts() do o.anisotropicPositionSmoothingWeight  = val
	)
	on spn_viewport changed val do
	(
		for o in getSelectedFrosts() do o.viewportMeshingResolution  = val
	)
	on spn_render changed val do
	(
		for o in getSelectedFrosts() do o.renderMeshingResolution  = val
	)

	on lbx_frostObjects selected itm do
	(
		local theSel = lbx_frostObjects.selection as array
		if theSel.count == 0 then 
            max select none 
         else
            select (for i in theSel collect theFrosts[i])
         updateControls()
	)
	
	on btn_Proxy pressed Do 
	(
		local theSel = lbx_frostObjects.selection as array --get the multilistbox selection 
		select (for i in theSel collect --loop through the selection and collect
		(
			local theClone = copy theFrosts[i] --copy the Frost object highlighted on the list
			theClone.name = uniquename (theFrosts[i].name + "_PROXY") --rename the clone
			convertToMesh theClone --collapse to Editable Mesh
			theClone.transform = matrix3 1 --reset the transforms since collapsed Frosts have pivot at origin
			theClone --return the clone for collecting
		))--select the resulting collection
   )	
      
	on Frost_Explorer_Dialog open do
	(
		theFrosts = for o in objects where classof o.baseobject == Frost collect o
		lbx_frostObjects.items = for o in theFrosts collect o.name   
	)
)
createDialog Frost_Explorer_Dialog width:180 --removed the height, so as you add controls, it grows automatically
)

wow nice!

for some reason there is a problem with neighbors and smoothing, sometimes neighbors works, sometimes not, smoothing doesnt seem to work at all,
and somehow even seems to break the frost modifier itself, changing spinner in frost seems to have no effect

Well, you had exposed the wrong property.

You had anisotropicPositionSmoothingWindowScale which is not exposed to the UI and defaults to 2.0 exposed as the anisotropicPositionSmoothingWeight (which ranges from 0.0 to 1.0). I have modified my previous post to fix that…

Will have to check with Paul to see what the hidden property really does.

anisotropicPositionSmoothingWindowScale does nothing now. (Position smoothing is how anisotropic meshing moves each particle toward its neighbors. In beta builds, this property let you control the filter size for such smoothing. Now it uses a fixed value instead.)

None of the button actions are, but some of them should be. “Force Viewport Update” seems especially nice to have on a HUD. Please let us know if there’s anything you want exposed.

Privacy | Site terms | Cookie preferences