Notifications
Clear all

[Closed] PFlow user data access?

Is there a way to access the user data channels (integer, float, vector) stored in a particle from script – NOT MaxScript operator.
I want to get it from outside of PF.
Found some threads saying they cannot be accesed
Is that true?

9 Replies

Out of curiosity, what are you trying to do?

Particles to spline script, but with a little more control than usually.
I’d like for example, through user data, to define which particles generate a spline and which do not.
Also using Berkon plugin I can have parent’s ID after spawn, which will allow me to build dependencies, but again, how do I get to that info from the outside ?

I would suggest looking at the PF Spliner script and change it to suit your needs.

It can be found HERE

You can grab most data generated by pflow using the functions listed inside the script operator.

Example of an external method:


 pf = $PF_Source_01
 count = pf.numparticles()
 for i = 1 to count do
 (
 	t = currentTime
 	print t
 	pIndex = (pf.getParticleIndex(i))-1
 	print pIndex 
 	pPos = pf.getParticlePositionByID i
 	print pPos
 )
 

I know and already done all that.
The problem is that the user data channels don’t seem to be exposed to Maxscript from the outside – they work from the inside.

Hmmm, keeps getting better and better.
The every step update and final step update scripts in the PF source also seem to have a problem with that – they output no value at all, not even undefined

Have you tried assigning a global variable in a script operator, populate it with your data, then accessing this variable outside of pflow?

That’s what I’m working on.

I’m trying to automate it for the user as much as possible so I want to script PFlow by MaxScript.

So far the every step and final step scripts failed as they also don’t have access to the user data channels – or am I missing something?

I’m trying to insert a Script_op in the Render event of PFlow – it works this way, but I stumbled on a problem with inserting script to the script operator so that it starts working
http://forums.cgsociety.org/showthread.php?p=6244088#post6244088

I’m having a really bad day

Sorry your having a bad day. LOL I hate to point you to another script, I wish I had a direct answer for you, too busy at the moment.

This may help…(you may have seen it already)
Galagast wrote a script that dynamically inserts script operators into a flow and then updates a live listview, you may want to look into that. Just an idea

PF Channel Info

Thanks for your help.

Unbelievable, but this was fixed with the same trick I found a couple of months ago.

Basically everything you do with PFlow using external MaxScript should be run in an Undo clause.
It’s probably the only way to make Max see all the changes you’ve made