Notifications
Clear all

[Closed] Point_cache

Hi
I want help to complete the script down

rollout test "test"
 (
 spinner Point_cache.start "start" type:#integer range:[1000,1000,1]
 spinner Point_cache.end frame "End Frame" type:#integer range:[0,1000,1]
 spinner Point_cache.frame "Frame" type:#integer range:[0,1000,1]
 checkbox Graph

 ) 

 createdialog test
2 Replies
1 Reply
(@gazybara)
Joined: 10 months ago

Posts: 0

First you need to look in maxscrip help document about Point Cache modifier
Anyway this is your script. I not have time to test this

try(DestroyDialog ::testRoll)catch()
rollout testRoll "PC_Playback"
(
	group "Playback Type:"
	(
		dropdownlist dd_types "" pos:[8,25] width:124 items:#("Original Range", "Custom Type", "Custom Range", "Playback Graph")
		spinner spn_start "Start Frame " pos:[10,50] fieldwidth:50 range:[-1e4,1e4,0] enabled:off
		spinner spn_end "End Frame   " pos:[10,70] fieldwidth:50 range:[-1e4,1e4,1e2] enabled:off
		spinner spn_frame "Frame		  " pos:[10,90] fieldwidth:50 range:[-1e4,1e4,0] enabled:off
		checkbox cb_graph "Clamp Graph" enabled:off
	)
	local ctrls = #(spn_start,spn_end,spn_frame,cb_graph)
	fn getPC node =
	(
		local pc
		for m in node.modifiers while pc == undefined where iskindof m Point_Cache do pc = m 
		pc	
	)
	fn enableCtrls ctr:ctrls which: =
	(
		for c = 1 to 4 do (if findItem which c == 0 then ctr[c].enabled = off else ctr[c].enabled = on)
	)
	on dd_types selected i do
	(
		case i of 
		(
			1: ctrls.enabled = off
			2: enableCtrls which:#(1)
			3: enableCtrls which:#(1,2)
			4: enableCtrls which:#(3,4)
		)
		if selection.count != 0 do 
			for o in selection where o.modifiers.count > 0 and isKindOf (pc = getPC o) modifier do (setProperty pc #playbackType (i-1))
	)
	on spn_start changed val do 
	(
		if selection.count != 0 do 
			for o in selection where o.modifiers.count > 0 and isKindOf (pc = getPC o) modifier do (setProperty pc #playbackStart val)
	)
	on spn_end changed val do 
	(
		if selection.count != 0 do 
			for o in selection where o.modifiers.count > 0 and isKindOf (pc = getPC o) modifier do (setProperty pc #playbackEnd val)
	)
	on spn_frame changed val do 
	(
		if selection.count != 0 do 
			for o in selection where o.modifiers.count > 0 and isKindOf (pc = getPC o) modifier do (setProperty pc #playbackFrame val)
	)
	on cb_graph changed state do
	(
		if selection.count != 0 do 
			for o in selection where o.modifiers.count > 0 and isKindOf (pc = getPC o) modifier do (setProperty pc #clampGraph state)
	)
)
createdialog testRoll 140 200 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)

Thanks
How do your script connect to the Script down

try(DestroyDialog ::testRoll)catch()
rollout testRoll "PC_Playback"
(
	group "Cache File"
	(
	 button btn_getPath "Browse" width:100
	 edittext edt_directory "Path:" text:"c:\	emp\\"
	 edittext edt_directory1 "Name:" text:"Sphere"
	 button btn_render "Load" width:100 height:30

		)
     	group "Playback Type:"
	(
		dropdownlist dd_types ""  width:124 items:#("Original Range", "Custom Type", "Custom Range", "Playback graph")
		spinner spn_start "Start Frame"  fieldwidth:50 range:[-1e4,1e4,0] enabled:false
		spinner spn_end "End Frame  "    fieldwidth:50 range:[-1e4,1e4,1e2] enabled:false
		spinner spn_frame "Frame	     "  fieldwidth:50 range:[-1e4,1e4,0] enabled:false
		checkbox cb_graph "Clamp Graph" enabled:false
	)
	  on btn_getPath pressed do 
		 (
		 local thePath = getSavePath initialdir:edt_directory.text
		 if thePath != undefined do edt_directory.text = thePath
		 )
		 
		  on btn_render pressed do
		 (
		 makeDir edt_directory.text all:true
		 if doesFileExist edt_directory.text then
		 (
		 $.modifiers[#Point_Cache_Binding].filename=edt_directory.text + "\\" +edt_directory1.text + ".xml"
		 )
		 )
	   on dd_types selected i do
 (
	 if i==1 then try
		 $.modifiers[#Point_Cache_Binding].playbackType = 0
			 catch

			(

			messageBox "Error: Please Select Object"

			results = undefined

			)

	 if i==1 then spn_start.enabled = false
	 if i==1 then spn_end.enabled = false
	 if i==1 then spn_frame.enabled = false
	 if i==1 then cb_graph.enabled = false
		 
	  if i==2 then try
		 $.modifiers[#Point_Cache_Binding].playbackType = 1
			 catch

			(

			messageBox "Error: Please Select Object"

			results = undefined

			)
		 
	 if i==2 then spn_start.enabled = true
	 if i==2 then spn_end.enabled = false
	 if i==2 then spn_frame.enabled = false
	 if i==2 then cb_graph.enabled = false
		 
	  if i==3 then try
		 $.modifiers[#Point_Cache_Binding].playbackType = 2
			 catch

			(

			messageBox "Error: Please Select Object"

			results = undefined

			)
		 
	 if i==3 then spn_start.enabled = true
	 if i==3 then spn_end.enabled = true
	 if i==3 then spn_frame.enabled = false
	 if i==3 then cb_graph.enabled = false
		 
	  if i==4 then try
		 $.modifiers[#Point_Cache_Binding].playbackType = 3
			 catch

			(

			messageBox "Error: Please Select Object"

			results = undefined

			)

	 if i==4 then spn_frame.enabled = true
	 if i==4 then cb_graph.enabled = true
	 if i==4 then spn_start.enabled = false
	 if i==4 then spn_end.enabled = false

	)
	on spn_start changed val do 
	(
		if selection.count != 0 do 
			for o in selection where o.modifiers.count > 0 and isKindOf (pc = getPC o) modifier do (setProperty pc #playbackStart val)
	)
	on spn_end changed val do 
	(
		if selection.count != 0 do 
			for o in selection where o.modifiers.count > 0 and isKindOf (pc = getPC o) modifier do (setProperty pc #playbackEnd val)
	)
	on spn_frame changed val do 
	(
		if selection.count != 0 do 
			for o in selection where o.modifiers.count > 0 and isKindOf (pc = getPC o) modifier do (setProperty pc #playbackFrame val)
	)
	on cb_graph changed state do
	(
		if selection.count != 0 do 
			for o in selection where o.modifiers.count > 0 and isKindOf (pc = getPC o) modifier do (setProperty pc #clampGraph state)
	)
	



)
createdialog testRoll 140 300 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)