Notifications
Clear all

[Closed] Freeze Pflow particles to mesh vertices

Hi,
I need to freeze Pflow particles to mesh vertices.
Similar to Bobo script, but bake not particles shape, but only position to new created mesh new vertices.
Bobo script to bake particles shape to new mesh:

fn filter_one_pflow = (selection.count == 1 and classof selection[1] == PF_Source)
       on isEnabled return  filter_one_pflow()
       on isVisible return filter_one_pflow()   on Execute  do
       (
     	pick_pflow =  selection[1]
     	holder_mesh =  Editable_Mesh()
     	holder_mesh.name = uniquename  (pick_pflow.name+"_Freeze")
     
       	with undo off
     	 (
     	  i = 0
     	   finish = false
     	  while not finish do
     	   (
     		i +=  1
     		pick_pflow.particleIndex =  i
     		current_mesh =  pick_pflow.particleShape
     		if current_mesh == undefined then
     		   finish = true
     		else
     		 (
     		  new_mesh =  Editable_Mesh()
     		   new_mesh.mesh =  current_mesh
     		   new_mesh.transform =  pick_pflow.particleTM
     		   attach holder_mesh new_mesh
     		 )
     	  )
     	)
     
       	 update holder_mesh
     	pushPrompt (i as string +" Particle(s) Frozen!")
        )
     

i’m not very good in scripting :sad:, so if someone can help me, i will be VERY thankful.

1 Reply

Almost 2 days of work and voila . Isn’t so hard like I supposed…

fn filter_one_pflow = (selection.count == 1 and classof selection[1] == PF_Source)
   
   	pick_pflow = selection[1]
   
   	new_mesh = Editable_Mesh()
   	new_mesh.name = uniquename (pick_pflow.name+"_Vertices")
   	new_mesh.transform = (matrix3 [1,0,0] [0,1,0] [0,0,1] [0,0,0])
   	convertToPoly(new_mesh)
   	with undo off
   	(
   	  i = 0
   	  finish = false
   	  while not finish do
   	  (
   		i += 1
   		pick_pflow.particleIndex = i
   		
   		  if pick_pflow.particleIndex == pick_pflow.numParticles() + 1 then
   		  finish = true
   		   else
   		  (
   		   new_mesh.createVertex pick_pflow.particlePosition
   		  )
   	   )
   	)
   
      update new_mesh
      pushPrompt (i as string +" Particle(s) Frozen!")

…if somebody find this useful ;).