Notifications
Clear all

[Closed] update particle flow in vp after its creation?

Hi Folks,

Just having a bit of an annoyance with a particle flow script here where it creates with no issues but doesn’t update in the viewports, in other words I don’t see any particles despite everything being correct in the flow. If I make another particle flow node in the particle view and delete it it updates the viewports fine and i can then see my particles – is there a command I need to use to get pflow to update?

Here’s some max 8 code:

-- make a pf node

fn MakePF particleCount positionObj shapeInst =
(
	
	PF_Source isSelected:on Logo_Size:100 Emitter_Length:100.0 Emitter_Width:100.0  Emitter_Height:0.01 pos:[0.0,0.0,0.0]
	
	-- make operators
	
	particleFlow.BeginEdit()
	
	op1 = Birth()
	op1.Emit_Start = 0
	op1.Emit_Stop = 0
	op1.amount = particleCount
	op2 = Position_Object()
	op2.Emitter_Objects.count = 0
	op2.Emitter_Objects = #(positionObj)
	op3 = Rotation()
	op4 = Shape_Instance()
	op4.Shape_Object = shapeInst
	op5 = RenderParticles()
	op6 = DisplayParticles()
	op6.color = $.wireColor
	
	-- make an event
	
	ev1 = Event()
	
	ev1.SetPViewLocation ($.X_Coord) ($.Y_Coord+100)
	particleFlow.EndEdit()
	
	-- Assign ops to event
	
	ev1.AppendAction op1
	ev1.AppendAction op2
	ev1.AppendAction op3
	ev1.AppendAction op4
	ev1.AppendAction op6
	$.AppendAction op5
	$.AppendInitialActionList ev1

)

-- UI =========================================================================================


rollout makePfNode "Make Particle flow Node"
(

	Global buttonWidth = 200
	Global buttonAlign = #right
	
	group "Particle Options"
	(
		spinner ParticleCount "Particle count" align:#right type:#integer range:[0,1000000,1000]
		pickbutton posObject "pick position Object" align:buttonAlign width:buttonwidth
		pickbutton ShapeInst "pick shape Instances" align:buttonAlign width:buttonwidth
	)
	
	button makePFNode "Make Particle flow node" align:buttonAlign width:buttonwidth enabled:false
	button CollapsePFNode "Collapse Particle flow node" align:buttonAlign width:buttonwidth enabled:false
	
	-- Button commands
	
	on posObject picked obj do
	(
		posObject.text = posObject.object.name
		if ShapeInst.object != undefined then makePFNode.enabled = trueE
		
	)
	
	on ShapeInst picked obj do
	(
		ShapeInst.text = ShapeInst.object.name
		if posObject.object != undefined then makePFNode.enabled = true
	)
	
	on makePFNode pressed do
	(
		MakePF ParticleCount.value posObject.object ShapeInst.object
	)
	
	on CollapsePFNode pressed do
	(
		
	)
	
)

createDialog makePFNode width:300



2 Replies
1 Reply
(@bobo)
Joined: 11 months ago

Posts: 0

The only workaround I know of is calling holdMaxFile() and then fetchMaxFile quiet:true to save and reload the scene. I have encountered the same problem and could not find anything else that fixes it. You can also save the file to disk and reload again using MAXScript or manually.

If there IS a solution, I would love to hear about it from Oleg

That’s a bit of a shame, I guess I’ll stick in an add and delete command at the end to see if it behaves. Cheers for the reply!