Hi!
First of all, I would like to point out that the Particle Data Viewer is 100% MAXScript, so it uses similar functions to the ones you are calling to check what channels exist, and to read their data. The main difference is that PDV is asking the PRT object itself, not the file.
It looks like this:
[code]a = FranticParticles.GetPRTObjectIStream $KrakatoaPRTLoader001 false false
–> MixinInterface:KrakatoaParticleIStream
showInterface a
–>
Interface: KrakatoaParticleIStream
Properties:
Methods:
GetCount()
GetChannels()
Close()
ReadParticle()
SkipParticles NumToSkip
Actions:
OK
c = a.GetChannels()
–> #(“Position float32[3]”, “ID int32[1]”, “Velocity float16[3]”, “Color float32[3]”)[/code]
While asking one file from the PRT Loader does this:
b = FranticParticles.GetFileParticleChannels $KrakatoaPRTLoader001.fileList[1]
#(#("Position", "float32", 3), #("ID", "int32", 1), #("Velocity", "float16", 3))
As you can see, the Color channel is not on that list. That is because the PRT Loader makes its own Color channel when there is no such data in the file, based on the Wirecolor of the object, or the Material assigned to the object. You will notice that there is a >> sign next to “Color” in PDV - that’s because PDV actually checks BOTH lists and marks any channels not appearing in the file but appearing in the PRT object as “not from file”!
For example, if you add a Magma Modifier to the stack of a PRT Loader and create an Output node “TextureCoord” and set it to [1,0,0] for all particles, the TextureCoord channel will not be in the PRT file, but will be on top of the stack in the object, and PDV will mark it with >> like the Color to let you know it was not “native”.
So if the PDV says there is no Orientation in the object, but MAXScript says there is, you might be looking at different files…
Regarding the setting of the Krakatoa Render Dialog channels list - nearly all settings of Krakatoa are defined and set via string methods, also exposed by the FranticParticles interface. If you look in the KrakatoaGUI.ms, you might find out that we store these in the property named “ActiveParticleChannels”. We store a single string with all values (name, type, arity) delimited by commas:
FranticParticles.getProperty "ActiveParticleChannels"
--> "Position,float32,3,Velocity,float16,3,Density,float16,1,Color,float16,3,Normal,float16,3,ID,int32,1"
As you can see, there is a function called
fn storeActiveChannels =
(
local thePropValue = ""
for i in activeChannels do thePropValue += i[1] + "," + i[2] + "," + i[3] as string + ","
if activeChannels.count > 0 do thePropValue = substring thePropValue 1 (thePropValue.count-1)
FranticParticles.setProperty "ActiveParticleChannels" thePropValue
)
It takes the content of the variable activeChannels which is an array of arrays like you get from the file access above, and flattens it out as a string.
Also look at the function setChannelsFromSelectedNodes() - it is exposed in the [>>] button between the two lists in the UI, and lets you pick any PRT object in the scene, and set the output list to the same channels. Another function, appendChannelsFromSelectedNodes(), lets you add the PRT object’s channels to the list of channels to save. The code there will show you how you can convert the return results of the methods discussed earlier above to the list you need to set your channels list.
But in general, you can just hard code it if you want, like this for example:
FranticParticles.setProperty "ParticleMode" "Save Particles To File Sequence" --force save mode
--then set some channels:
FranticParticles.setProperty "ActiveParticleChannels" "Position,float32,3,Velocity,float16,3,Color,float16,3,ID,int32,1,Orientation,float16,4"
--refresh the rollout if the Krakatoa GUI is open and you want to see them listed:
Krakatoa_GUI_SaveParticles.Refresh_GUI()
Hope this helps!