numParticles() returns inaccurate result
#3
(05-10-2024, 02:38 AM)tyFlow Wrote: Did you call updateParticles first?

Yes, I did call updateParticles first. As in the post image, the first line is  $.updateParticles 15. [Image: attachment.php?aid=3472]

I also tried to write those code into a ms script. The result is also the same.

By the way, I can get Id from getAllParticleIDs(), when I have 169 particles, the array is properly filled with (1, 2, 3, ..., 169). But getParticleAge always returns 0, getParticlePosition returns (0, 0, 0) no matter what frame number I gave to updateParticles() function.

I attached my max scene and script run result.


.max   UE4_Max_VAT_Test011.max (Size: 912 KB / Downloads: 85)

here's my test code:

Code:
macroScript TestTools_TyflowTest category:"Test Tools" buttontext:"Test Tools" tooltip:"Test Tools"
(
    fn TestRead = (
       
        local tf = $tyFlow002
        --local tfSpline = $tfSplines001
        tf.updateParticles 15 -- update before read
        local numParticles = tf.numParticles()
        -- local tms = tf.getAllParticleTMs()

        -- show tf -- properties
        -- showinterfaces tf -- methods

        -- numParticles = 1

        format "TestRead: tf: %, numPartciels: %\n" tf numParticles
        format "Class tf %\n" (superClassOf tf) -- GeometryClass
        --format "Class tfSpline %\n" (superClassOf tfSpline) -- tfSpline Value
       

        --for j in 1 to numParticles do
        --(
            --local tm = tms[j]
        --)
        local ids = tf.getAllParticleIDs()
        format "tf id array: %\n" ids
        for id in ids do
        (
            format "processing particle id: %\n" id
            local age = tf.getParticleAge(id)
            local pos = tf.getParticlePosition(id)
            format "age: %; pos: %\n" age pos
        )
       
    )
    TestRead()
)
macros.run "Test Tools" "TestTools_TyflowTest"

the result is

[Image: attachment.php?aid=3476]


Attached Files Thumbnail(s)
   
  Reply


Messages In This Thread
RE: numParticles() returns inaccurate result - by Alan2024 - 05-10-2024, 07:05 AM

Forum Jump: