[Closed] making a pflow button
Hello every one
I'm pretty green when it comes to scripting so plz bare with me. :)
I'm trying to make a button that makes a PF_Source...Seems simple enough, I can make the script that makes the PF_Source and when you go to the ParticleViewer it shows up correctly,renders particles and displays them in the view port . But if I try to put that code into a button it creats the PF_Source but the "Render" and "Display" operators dont seem to work any more.
This code makes the PF_Source
pf=PF_Source()
--pf.Enable_Particles= true
particleFlow.beginEdit()
ev=event()
br=birth()
pf.appendInitialActionList ev
ev.appendAction br
ev.appendAction (Position_Icon())
ev.appendAction (Speed())
ev.appendAction (ShapeStandard())
ev.appendAction (DisplayParticles ())
pf.appendAction (RenderParticles())
particleFlow.endEdit()
and this is so post to be it with the button
rollout Rollout1 "particle flow tool box" width:200
(
button pflow "Pflow"
on pflow pressed do
(
pf=PF_Source()
--pf.Enable_Particles= true
particleFlow.beginEdit()
ev=event()
br=birth()
pf.appendInitialActionList ev
ev.appendAction br
ev.appendAction (Position_Icon())
ev.appendAction (Speed())
ev.appendAction (ShapeStandard())
ev.appendAction (DisplayParticles ())
pf.appendAction (RenderParticles())
particleFlow.endEdit()
)
)
createDialog Rollout1
any ideas would be great for I have run out :bowdown:
There is an old bug in PFlow which causes it not to generate particles if created by MAXScript until the scene is saved and reloaded again. You might have hit that problem here. Try running the script, then save the scene (or Edit>Hold it) and then load it again (or Edit>Fetch it) and see if the flow will become fertile again.
If that works, just figure out how to do a hold and quiet fetch using MAXScript (it is in the MAXScript Reference, and possibly in a couple of threads on this forum) and you will have your workaround
If it does not help, I will have to look at it again…
Thank you Bobo that work out nicely. After a few of us worked on this we found that if you put the PF_Source ‘code’ into a macro script and make it a button on the tool bar it will display the particles with out haveing to reset the scene.
Thanks for the help :bowdown: