Maxscript – Pflow Tools /*Update 18/11/2014*/

/, Varie/Maxscript – Pflow Tools /*Update 18/11/2014*/

Maxscript – Pflow Tools /*Update 18/11/2014*/

ENG

This script allows you to easily select and rename your pflow and spacewarps elements. Very handy if you have multiple particles simulation or complex events list. Comments, suggestions, and bug reports will be extremely appreciated.

Installation:
– Run the script MaxScript -> Run Script…
– Go to Customize -> Custom User Interface
– It can be found in “Silver3D”.
– Add it to a button or menu.
– Enjoy!

/*UPDATE! Version .05*/

NEW in .05
– Color picker for display Ops
– Add support for TP and standard Particle System
– Bug fix..

ITA

Questo script permette di selezionare e rinominare velocemente gli elemnti del Particle Flow e i vari spacewarps, in modo da rendere più semplice la gestione di scene con molti effetti particellari.

Installazione:
– Lanciate lo script da MaxScript -> Run Script…
– Andare in Customize -> Custom User Interface
– Lo script si trova nella categoria “Silver3D”.
– Aggiungetelo alla UI come bottone o menu.
– Enjoy!

/*UPDATE! Version .05*/

NEW in .05
– Color picker per l’operatore display
– Aggiunto supporto per TP e Particle System standard
– Bug fix..

CODE FILE

“PFlow Lists Tools.ms”


macroScript PFlow_Tools 
category:"Silver3D" 
tooltip:"PFlow Tools"
buttonText:"PFlow Tools"  

	/* PFlow Lists Tools rename*/
	/*List of all events and operator in in pflow*/
	/*List of all force in scene*/ 
	
	--Written by Federico Nobili 
	--www.silver3d.it
	
	/*NEW in .05
	- Color picker for display Ops
	-Add support for TP and standard Particle System
	-Bug fix..
	*/
	
(--start script	
	--VAR 
	global Pass_Ops_name
	global PFlow_tools_05 
	global Events_Array = #()
	global SpacewarpObject_Array = #()
	global Birth_Array = #()
	global DeleteParticles_Array = #()
	global Group_Array = #()
	global Transform_Array = #()	
	global Speed_Array = #()
	global Shape_Array = #()
	global Material_Array = #()	
	global Other_Array = #()
	global Test_Array = #()
	global DisaplyArray = #()
	global CacheArray = #()
	global MassFXArray = #()
	global PF_StuffArray = #()
	global PF_PSystemArray = #()
	global PF_ThinkingArray = #()
	global Total_Array = #() -- Array of Array of ALL Pflow operator
	global The_DisplayArray =#() --Array of Array selected from Total_Array
	global The_DisplayArray_List = #() --Array of The_DisplayArray name, items in The_PflowOps_list items array
	global txt
	global Selection_Value
	global itm
	global DDL
	global new_col
	
--UI start
	try(cui.unRegisterDialogBar PFlow_tools_05)catch() 
	try(destroyDialog PFlow_tools_05 )catch()
	rollout PFlow_tools_05 "PFlow Lists Tools"	
	(
--GUI
		dropdownlist DDLbx1_list "PFlow Operators" items:#("Birth", "DeleteParticles", "Group", "Transform", "Speed", "Shape", "Material", "Other", "Test", "Events", "Display", "Cache", "MassFX", "PFlow", "Particle System", "TP" )  --height:15
		button Reloaf_PflowEl_List "Reload Events List"  height:28 width:130
		button btn_clear "Clear List" height:28 width:130
		button btn_Dispaly_ALL "Display All"height:28 width:130
		listbox The_PflowOps_list "PFlow Sub-Operators" height:15 offset: [0,10]
		Label New_Name "New Name"
		edittext Ops_Text ""offset: [0,10]
		Button btn_Toggle_Off_Ops "Toggle Off Ops" height:28 width:130 offset: [0,10]
		listbox SpacewarpObject_list "SpacewarpObject List" height:6  offset: [0,10]
		Label New_Name2 "New Name" 
		edittext SpacewarpObject_Text ""offset: [0,10]
		button Reload_SwObj_List "Reload SpcWarps-Obj"  height:28 width:130  offset: [0,10]
		Label space_ "--== Other options ==--" offset: [0,10]
		colorpicker theColor "Selection color:" color:[0,0,255] modal:false offset: [0,10]
		button Toggle_Particle_Count "Toggle Particle Count" height:28 width:130 offset: [0,10]
		button Done "Close" height:22 width:130 offset: [0,5]
		button help "Help"  width:130 height:22
		HyperLink Copycenter "       --== Silver3d.it ==--"  width:130 height:13 address:"www.silver3d.it" hovercolor:(color 98 175 22) offset: [0,10]
--FN
	fn fn_Reload_SpacewarpObject_list =
	(
		SpacewarpObject_Array =#()
		for i in ($* as array) do 
			 ( 
				if superclassof i == SpacewarpObject do
					(
						appendifunique SpacewarpObject_Array i.name
					--	Total_Array[1] = Birth_Array
					)
			 )
			SpacewarpObject_list.items = SpacewarpObject_Array
		 )
	fn fn_Reload_Events_list =
	(
		/*Reset Var and Array value*/
		Pass_Ops_name = undefined
		Selection_Value = undefined
		Events_Array = #()
	    Birth_Array = #()
	    DeleteParticles_Array = #()
	    Group_Array = #()
	    Transform_Array = #()	
	    Speed_Array = #()
	    Shape_Array = #()
	    Material_Array = #()	
	    Other_Array = #()
	    Test_Array = #()
	    DisaplyArray = #()
		CacheArray = #()
		MassFXArray = #()
		PF_StuffArray = #()
		PF_PSystemArray = #()
		PF_ThinkingArray = #()
		Total_Array = #()for i in ($* as array) do 
			 ( 
				if classof i == Birth or classof i == Birth_File  or classof i == Birth_Group or classof i == BirthGrid or classof i == Birth_Paint or classof i == Birth_Script or classof i == BirthStrean  or classof i == Birth_Texture or classof i == Initial_State do
					(
						appendifunique Birth_Array i.name
						Total_Array[1] = Birth_Array
					)
			 )
		for i in ($* as array) do 
			 ( 
				if classof i == DeleteParticles do
					(
						appendifunique DeleteParticles_Array i.name
						Total_Array[2] = DeleteParticles_Array
					)
			 )
		for i in ($* as array) do 
			 ( 
				if classof i == Group_Select or classof i == Group_Operator do
					(
						appendifunique Group_Array i.name
						Total_Array[3] = Group_Array
					)
			 )
		for i in ($* as array) do 
			 ( 
				if classof i == Position_Icon or classof i == Position_Object  or classof i == Placement_Paint or classof i == rotation or classof i == scaleParticles or classof i == Spin do
					(
						appendifunique Transform_Array i.name
						Total_Array[4] = Transform_Array
					)
			 )
		for i in ($* as array) do 
			 ( 
				if classof i == Keep_Apart or classof i == speed  or classof i == Speed_By_Surface or classof i == SpeedByIcon or classof i == Stop or classof i == Stop_Gradually do
					(
						appendifunique Speed_Array i.name
						Total_Array[5] = Speed_Array
					)
			 )
		for i in ($* as array) do 
			 ( 
				if classof i == shapeStandard or classof i == Shape_Facing  or classof i == Shape_Instance or classof i == Shape_Mark or classof i == ShapeLibrary do
					(
						appendifunique Shape_Array i.name
						Total_Array[6] = Shape_Array
					)
			 )		
		for i in ($* as array) do 
			 ( 
				if classof i == mapping or classof i == Mapping_Object  or classof i == Material_Dynamic or classof i == Material_Frequency or classof i == Material_Static do
					(
						appendifunique Material_Array i.name
						Total_Array[7] = Material_Array
					)
			 )		
		for i in ($* as array) do 
			 ( 
				if classof i == Camera_Culling or classof i == Camera_IMBlur or classof i == Data_Operator or classof i == Data_Icon or classof i == Force or classof i == Script_Operator or classof i == PresetOperIcon or classof i == FumeFX_Follow or classof i == Krakatoa_Geometry_Lookup or classof i == Krakatoa_PRT_Update or classof i == RealFlowFileUpdate or classof i == FumeFX_Follow or classof i == PresetOperator do
					(
						appendifunique Other_Array i.name
						Total_Array[8] = Other_Array
					)
			 )	
		for i in ($* as array) do 
			 ( 
				if classof i == Age_Test or classof i == Spawn or classof i == Test_Icon or classof i == Collision  or classof i == Krakatoa_Collision_Test  or classof i == Krakatoa_File_ID_Test  or classof i == Krakatoa_Geometry_Test  or classof i == RealFlowDeathTest or classof i == Stop_Gradually do
					(
						appendifunique Test_Array i.name
						Total_Array[9] = Test_Array
					)
				)
		for i in ($* as array) do 
			 ( 
				if classof i == Event do
					(
						appendifunique Events_Array i.name
						Total_Array[10] = Events_Array
					)
			)	
		for i in ($* as array) do 
			 ( 
				if classof i == DisplayParticles do
					(
						appendifunique DisaplyArray i.name
						Total_Array[11] = DisaplyArray
					)
			)
		for i in ($* as array) do 
			 ( 
				if classof i == Cache or classof i == Cache_Disk or classof i == Cache_Selective do
					(
						appendifunique CacheArray i.name
						Total_Array[12] = CacheArray
					)
			)
		for i in ($* as array) do 
			 ( 
				if classof i == mP_Worldhelper  or classof i == mP_Shape or classof i == mP_Switch or classof i == mP_Solvent  or classof i == mP_Buoyancy or classof i == mP_Force or classof i == mP_Drag or classof i == mP_World or classof i == mP_Shape or classof i == BirthGrid or classof i == mP_Glue or classof i == mP_InterCollision or classof i == mP_Collision do
					(
						appendifunique MassFXArray i.name
						Total_Array[13] = MassFXArray
					)
			)
		for i in ($* as array) do 
			 ( 
				if classof i == PFEngine  or classof i == RenderParticles or classof i == PF_Source or classof i == Particle_View do
					(
						appendifunique PF_StuffArray i.name
						Total_Array[14] = PF_StuffArray
					)
			)
		for i in ($* as array) do 
			 ( 
				if classof i == PArray  or classof i == Blizzard or classof i == Snow or classof i == PCloud or classof i == Spray or classof i == SuperSpray do
					(
						appendifunique PF_PSystemArray i.name
						Total_Array[15] = PF_PSystemArray
					)
			)
		for i in ($* as array) do 
			 ( 
				if classof i == Thinking  do
					(
						appendifunique PF_ThinkingArray i.name
						Total_Array[16] = PF_ThinkingArray
					)
			)
/*Update list*/			
		The_DisplayArray_List = #()
		The_PflowOps_list.items = The_DisplayArray_List
	)
fn fn_Display_All =
(
	fn_Reload_Events_list()
	The_DisplayArray_List =#()
	for i = 1 to Total_Array.count where Total_Array[i]!= undefined do
	(
		for u =1 to Total_Array[i].count do	appendifunique The_DisplayArray_List Total_Array[i][u]
	)
)
--ON OPEN
on PFlow_tools_05 open do
(
	fn_Reload_Events_list()
	fn_Reload_SpacewarpObject_list()
	fn_Display_All()
	The_PflowOps_list.items = The_DisplayArray_List
)

--button action
on btn_Dispaly_ALL pressed do
(
	fn_Display_All()
	The_PflowOps_list.items = The_DisplayArray_List
)
on btn_Toggle_Off_Ops pressed do	--Toggle Operator or events on/Off
(
	try
	(
		if Pass_Ops_name!= undefined or Pass_Ops_name != "" do
			(						
				ind = 0
				execute ("Select $" + "'" + Pass_Ops_name + "'")
				if classof $ == Thinking or classof $ == PArray  or classof $ == Blizzard or classof $ == Snow or classof $ == PCloud or classof $ == Spray or classof $ == SuperSpray or  classof $ == PFEngine  or classof $ == RenderParticles or classof $ == PF_Source or classof $ == Particle_View then
				(
					messagebox "Can't disable that!" beep:false
				)
				else
				(
					if classof $ != Event then 
					(				
						bt = $
						clearSelection()
						for i =1 to Events_Array.count do 
						(
								execute ("Select $" + "'" + Events_Array[i] + "'")
								if ( $.hasAction bt &ind) do 
										(								
											if (($.isActionActive ind) == 1) then ($.activateAction ind 0) else ($.activateAction ind 1)
											format "Events: % Op: % Set: %\n" Events_Array[i] Pass_Ops_name ($.isActionActive ind)					
										)
						)
					)
					else 
						(
							execute ("Select $" + "'" + Pass_Ops_name + "'")
							if $.isActivated() then	$.activate false else $.activate true
							format "Events: % Set: %\n" Pass_Ops_name ($.isActivated())
						)
				)
			)
	)catch()
)
on btn_clear pressed do	--Clear List
(
	The_DisplayArray = #()
	The_DisplayArray_List = #()
	The_PflowOps_list.items = The_DisplayArray_List
	fn_Reload_Events_list()
)
on DDLbx1_list selected DDL do --Selection of elements to display in The_PflowOps_list
(
	try(
		The_DisplayArray_List = #()
		if Total_Array[DDl] != undefined do
		(
			for u = 1 to Total_Array[DDL].count do	appendifunique The_DisplayArray_List Total_Array[DDL][u]
		)			
		The_PflowOps_list.items = The_DisplayArray_List
	)catch()		
)
on The_PflowOps_list selected item do	--Selected elements inThe_PflowOps_list
	(
		try(
		Selection_Value = item
		Ops_Text.text = The_DisplayArray_List[item]
		Pass_Ops_name = Ops_Text.text 
		execute ("Select $" + "'" + The_DisplayArray_List[Selection_Value] + "'")
		theColor.color = $.color
		)catch()
	)
On Ops_Text changed txt do	--New name changer fn
	(
		Pass_Ops_name = txt	
		$.name = Pass_Ops_name	
		The_DisplayArray_List[Selection_Value] = Pass_Ops_name
		The_PflowOps_list.items = The_DisplayArray_List		
	)
on SpacewarpObject_list selected item do	--Selected elements
	(
		Selection_Value = item
		SpacewarpObject_Text.text = SpacewarpObject_Array[item]
		Pass_Ops_name = SpacewarpObject_Text.text
		execute ("Select $" + "'" + SpacewarpObject_Array[item] + "'")
	)
On SpacewarpObject_Text changed txt do 		--New name changer fn<
(
	Pass_Ops_name = txt	
	SpacewarpObject_Array[Selection_Value] = Pass_Ops_name
	$.name = Pass_Ops_name	
	SpacewarpObject_list.items = SpacewarpObject_Array	
)
on Done pressed do --close rollout
(
		try(cui.unRegisterDialogBar PFlow_tools_05)catch() 
	(try(destroyDialog PFlow_tools_05 )catch())
)
on Reloaf_PflowEl_List pressed do	--Update The_PflowOps_list
(
	fn_Reload_Events_list()
)
on Reload_SwObj_List pressed do	--Update The_PflowOps_list
(
	fn_Reload_SpacewarpObject_list()
)
on Toggle_Particle_Count pressed do --Toggle_Particle_Count On/Off
(
	try(
	for i  in ($* as array) where (((i.classID)[1])== 1962490631) and (((i.classID)[2])== 515064576) do /*Get particle View*/
	(
		print i
		particleFlow.BeginEdit()
		if (i.Show_Particle_Count == 1) then
		(
			(i.Show_Particle_Count = 0)
			print (i.name + " Count disable")
		) else
		(
			(i.Show_Particle_Count = 1)
			print (i.name + " Count Enable")
		)
		particleFlow.EndEdit()
	)
	)catch()
)
on theColor changed new_col do 
  (
	  try(
		  $.wirecolor = new_col
		  $.color = new_col 
	  )catch()
  )

on help pressed do 
(
	messagebox "PFlow Lists Tools - 2014\nThe sript allows you to easly select and rename Pflow Event and operators\nAuthor: Federico Nobili\nWebsite: www.silver3d.it" beep:false title:"PFlow Lists Tools - Help"
)
	)--end rollout
	createdialog PFlow_tools_05 width:160  style:#(#style_titlebar, #style_border, #style_sysmenu, #style_resizing) --pos:[1200,1200]
	cui.RegisterDialogBar PFlow_tools_05 minSize:[160, 200] maxSize:[-1, 1200] style:#(#cui_dock_vert, #cui_floatable, #cui_handles)
)--end script

2018-09-17T10:29:03+00:00novembre 5th, 2014|Script, Varie|