Notifications
Clear all

[Closed] refresh particleflow

This all happens in MaxScript

I create a pfsource, render, display
then i append a event to that pfsource with a force and a birth script

I change the birth script while inside maxscript

And if i want to test that … it doesn’t work
it works after i do some stupid things like I add a rotation to the event and then i remove that rotation. Then it works …

Is there a way to solve this in maxscript ? I tried doing the workaround above in maxscript (with create rotation append to event and then delete the rotation but that didn’t work either) so my guess particle flow does a command that doesn’t show in the listener.

I also tried beginedit and endedit … that didn’t help much

12 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

What do you actually change? Do you change Proceed_Script of the Birth_Script? Or you change Birth_Script of the Event…

If you are building a PFlow via MAXScript, chances are the final flow won’t “flow” until you perform a scene save / reload or, easier, Hold and Fetch (you can do these via MAXScript). It has been this way since Max 5 and I don’t know what the problem is.

If I misunderstood your question, please clarify.

1 Reply
(@banemus)
Joined: 11 months ago

Posts: 0

I tried:

max Hold
max Fetch

And it works sometimes but not always :s this is really irritating
this is quiet a noticeable bug and after so many itterations of max they should have fixed something like this already

yes that’s one bug I really hope they fix…

sometime ago I made this to try to evaluate line by line from the listener
unfortunately it only evaluate one line for some reason ,do you think it could work :shrug:

try(destroydialog PfEvaluator)catch()
(
global PfEvaluator
–//–
local SendKeys=dotNetclass “System.Windows.Forms.SendKeys”
local MaxChild=windows.getChildrenHWND #max
local MiniPtr=undefined
local MxDone=true
local StrContainer=#()
local WM_ACTIVATE = 0x6
–//–
for f in 1 to MaxChild.count do
(
if MaxChild[f][4]==“MXS_Scintilla” then
(
MiniPtr=MaxChild[f][1] ; exit
)
)
–//–
fn EvaluateString thestring =
(
clearlistener()
format thestring
Windows.sendMessage MiniPtr WM_ACTIVATE MiniPtr 0
SendKeys.SendWait “+~”
SendKeys.SendWait “+~”
forcecompleteredraw doDisabled:true
MxDone=true
)
–//–
fn evaluate =
(
append StrContainer “Flow = PF_Source()”
append StrContainer “Flow.Show_Logo = False”
append StrContainer “Flow.Show_Emitter = True”
append StrContainer “Flow.isSelected = true”
append StrContainer “Flow.Emitter_Length = 50”
append StrContainer “Flow.Emitter_Width = 50”
append StrContainer “Flow.Quantity_Viewport = 100”
append StrContainer “Flow.name = “Tornado””
append StrContainer “x=y=1”
append StrContainer “ParticleFlow.BeginEdit()”
append StrContainer “Lva = RenderParticles()”
append StrContainer “Flow.AppendAction Lva”
append StrContainer “ParticleFlow.EndEdit()”
append StrContainer “Flow.GetPViewLocation &x &y”
append StrContainer “ParticleFlow.BeginEdit()”
append StrContainer “Lva = Birth Emit_Start:(-100) Emit_Stop:300 Amount:400”
append StrContainer “Lvb = Position_Icon Location:3”
append StrContainer “Lvc = Speed Direction:0”
append StrContainer “Lvd = Rotation()”
append StrContainer “Lve = DisplayParticles Type:1 Color:(color 255 255 255)”
append StrContainer “LvEvent = Event()”
append StrContainer “LvEvent.AppendAction Lva”
append StrContainer “LvEvent.AppendAction Lvb”
append StrContainer “LvEvent.AppendAction Lvc”
append StrContainer “LvEvent.AppendAction Lvd”
append StrContainer “LvEvent.AppendAction Lve”
append StrContainer “ParticleFlow.EndEdit()”
append StrContainer “Flow.appendInitialActionList LvEvent”
append StrContainer “LvEvent.SetPViewLocation x (y+120)”
–//–
while StrContainer.count != 0 do
(
if MxDone then
(
–sleep 0.5
MxDone=false
EvaluateString StrContainer[1]
deleteitem StrContainer 1
)
–//–
)
–//–
)
–//–
rollout PfEvaluator “PfEvaluator”
(
button btnX “Evaluate” offset:[0,10]
on btnX pressed do evaluate()
)
createdialog PfEvaluator 180 60
)

Best regard,
Martin

yes , and hold/fetch maybe acceptable on empty scene but it tend to be a bit slow when there’s more than one sphere …I need to create/destroy the pflow as fast as possible!!

got it

Cheer!!


try(destroydialog PfEvaluator)catch()
(
global PfEvaluator
--//--
local SendKeys=dotNetclass "System.Windows.Forms.SendKeys"
local MaxChild=windows.getChildrenHWND #max
local MiniPtr=undefined
local StrContainer=#()
local WM_ACTIVATE = 0x6
local WM_KEYDOWN = 0x100
local WM_KEYUP = 0x101	
local VK_UP = 0x26
local VK_DOWN = 0x28
--//--
for f in 1 to MaxChild.count do
	(
	if MaxChild[f][4]=="MXS_Scintilla" then 
		(
		MiniPtr=MaxChild[f][1] ; exit 
		)
	)
--//--
fn Sendkey Handle keycode IntRepeat =
	(
	for i in 1 to IntRepeat do
		(
		Windows.sendMessage Handle WM_KEYDOWN keycode 0
		Windows.sendMessage Handle WM_KEYUP keycode 1
		)
	)
--//--
fn evaluate =
	(
	clearlistener()
	append StrContainer "x=y=1"
	append StrContainer "Flow = PF_Source()"
	 append StrContainer "Flow.Show_Logo = False"
	append StrContainer "Flow.Show_Emitter = True"
	append StrContainer "Flow.isSelected = true"
	append StrContainer "Flow.Emitter_Length = 50"
	append StrContainer "Flow.Emitter_Width = 50"
	append StrContainer "Flow.Quantity_Viewport = 100"
	append StrContainer "Flow.name = \"Tornado\""
	append StrContainer "ParticleFlow.BeginEdit()"
	append StrContainer "Lva = RenderParticles()"
	append StrContainer "Flow.AppendAction Lva"
	append StrContainer "ParticleFlow.EndEdit()"
	append StrContainer "Flow.GetPViewLocation &x &y"
	append StrContainer "ParticleFlow.BeginEdit()"
	append StrContainer "Lva = Birth Emit_Start:(-100) Emit_Stop:300 Amount:400"
	append StrContainer "Lvb = Position_Icon Location:3"
	append StrContainer "Lvc = Speed Direction:0"
	append StrContainer "Lvd = Rotation()"
	append StrContainer "Lve = DisplayParticles Type:1 Color:(color 255 255 255)"
	append StrContainer "LvEvent = Event()"
	append StrContainer "LvEvent.AppendAction Lva"
	append StrContainer "LvEvent.AppendAction Lvb"
	append StrContainer "LvEvent.AppendAction Lvc"
	append StrContainer "LvEvent.AppendAction Lvd"
	append StrContainer "LvEvent.AppendAction Lve"
	append StrContainer "ParticleFlow.EndEdit()"
	append StrContainer "Flow.appendInitialActionList LvEvent"
	append StrContainer "LvEvent.SetPViewLocation x (y+120)"
	--//--
	clearlistener()
	for f in StrContainer do format(f+"
")
	Sendkey MiniPtr VK_UP (StrContainer.count+1)
	--//--
	for f in 1 to StrContainer.count do
		(
		Windows.sendMessage MiniPtr WM_ACTIVATE MiniPtr 0
		SendKeys.SendWait "+~"
		Sendkey MiniPtr VK_DOWN 1
		)
	--//--
	)
--//--
rollout PfEvaluator "PfEvaluator"
	(
	button btnX "Evaluate" offset:[0,10]
	on btnX pressed do evaluate()
	)
createdialog PfEvaluator 180 60
)



Hi, that’s me again :shrug:

I fixed the array that filled up and also added some more speed by disabling the redraw …
of course this assume that there will be no error along the way , if they are then anything bellow will have too and may lead to strange behavior …use with caution

Martin

does that work for me aswel ?

the refresh problem?

well ,yes I think… you may need to adapt/modify it
also, I only tested under max2010x64

k ill test that out thx

Sendkey MiniPtr VK_UP (StrContainer.count+1)
–//–
for f in 1 to StrContainer.count do
(
Windows.sendMessage MiniPtr WM_ACTIVATE MiniPtr 0
SendKeys.SendWait “+~”
Sendkey MiniPtr VK_DOWN 1
)
–//–
)

can you explain that plz what actually happens
cause i don’t see you sending the strings to the particle flow but still it gets there how?

Page 1 / 2