<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: scripted PFlow creation taking a long time... in 3ds Max Programming Forum</title>
    <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-pflow-creation-taking-a-long-time/m-p/4103287#M23899</link>
    <description>That method is called when you push the button to open a particle view... It usually only makes one per scene... but I've seen more than one in a scene before too...</description>
    <pubDate>Thu, 09 Jul 2009 20:08:06 GMT</pubDate>
    <dc:creator>keithm</dc:creator>
    <dc:date>2009-07-09T20:08:06Z</dc:date>
    <item>
      <title>scripted PFlow creation taking a long time...</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-pflow-creation-taking-a-long-time/m-p/4103285#M23897</link>
      <description>So I am working on a script to make a fairly complicated PFlow.  I've encountered a problem where each time the script appends another test and then wires it to a new event, the time to process the script increases dramatically.  Here's a sample piece of code with the output below:&lt;BR /&gt;&lt;BR /&gt;MaxScript:&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;particleFlow.BeginEdit&amp;amp;#40;&amp;amp;#41;&lt;BR /&gt;evB = Event name:&amp;amp;#40;"Event_B"&amp;amp;#41;&lt;BR /&gt;evB_opScriptOp = Script_Operator Proceed_Script:&amp;amp;#40;"on ChannelsUsed pCont do &amp;amp;#40; pCont.useFloat = true; &amp;amp;#41; on Init pCont do &amp;amp;#40;&amp;amp;#41; on Proceed pCont do &amp;amp;#40; count = pCont.NumParticles&amp;amp;#40;&amp;amp;#41; for i in 1 to count do &amp;amp;#40; pCont.particleIndex = i; pCont.particleFloat = random 0.0 10.0; &amp;amp;#41; &amp;amp;#41; on Release pCont do &amp;amp;#40;&amp;amp;#41;"&amp;amp;#41;&lt;BR /&gt;particleFlow.EndEdit&amp;amp;#40;&amp;amp;#41;&lt;BR /&gt;evB.AppendAction evB_opScriptOp&lt;BR /&gt;&lt;BR /&gt;for i = 1 to 5 do &amp;amp;#40;&lt;BR /&gt; t1 = timestamp&amp;amp;#40;&amp;amp;#41;&lt;BR /&gt; particleFlow.BeginEdit&amp;amp;#40;&amp;amp;#41;&lt;BR /&gt; evC = Event name:&amp;amp;#40;"Event_C_"+ i as string&amp;amp;#41;&lt;BR /&gt; t2 = timestamp&amp;amp;#40;&amp;amp;#41;&lt;BR /&gt; evB_opScriptTest = Script_Test Proceed_Script:&amp;amp;#40;"on ChannelsUsed pCont do &amp;amp;#40; pCont.useFloat = true; &amp;amp;#41; on Init pCont do &amp;amp;#40;&amp;amp;#41; on Proceed pCont do &amp;amp;#40; count = pCont.NumParticles&amp;amp;#40;&amp;amp;#41; for i in 1 to count do &amp;amp;#40; pCont.particleIndex = i; if pCont.particleFloat &amp;lt;= "+ i as string +" do &amp;amp;#40; pCont.particleTestStatus = true; &amp;amp;#41; &amp;amp;#41; &amp;amp;#41; on Release pCont do &amp;amp;#40;&amp;amp;#41;"&amp;amp;#41;&lt;BR /&gt; t3 = timestamp&amp;amp;#40;&amp;amp;#41;&lt;BR /&gt; particleFlow.EndEdit&amp;amp;#40;&amp;amp;#41;&lt;BR /&gt; t4 = timestamp&amp;amp;#40;&amp;amp;#41;&lt;BR /&gt; evB.AppendAction evB_opScriptTest&lt;BR /&gt; t5 = timestamp&amp;amp;#40;&amp;amp;#41;&lt;BR /&gt; evB_opScriptTest.setNextActionList evC evB_opScriptTest&lt;BR /&gt; print &amp;amp;#40;"Setup time:"+ &amp;amp;#40;t2 - t1&amp;amp;#41; as string +" Create Script_Test:"+ &amp;amp;#40;t3 - t2&amp;amp;#41; as string +" End edit:"+ &amp;amp;#40;t4 - t3&amp;amp;#41; as string +" Append:"+ &amp;amp;#40;t5 - t4&amp;amp;#41; as string +" Wire:"+ &amp;amp;#40;timestamp&amp;amp;#40;&amp;amp;#41; - t5&amp;amp;#41; as string +" Total:"+ &amp;amp;#40;timestamp&amp;amp;#40;&amp;amp;#41; - t1&amp;amp;#41; as string&amp;amp;#41;&lt;BR /&gt;&amp;amp;#41;&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Listener Output:&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;OK&lt;BR /&gt;&amp;amp;#36;Event:Event_B @ &lt;BR /&gt;MouseTool:ScriptAction8A887020&lt;BR /&gt;&amp;amp;#36;Script_Operator:Script Operator 01 @ &lt;BR /&gt;OK&lt;BR /&gt;true&lt;BR /&gt;MouseTool:ScriptAction49389BB0&lt;BR /&gt;"Setup time:1 Create Script_Test:3 End edit:0 Append:87 Wire:155 Total:246"&lt;BR /&gt;MouseTool:ScriptAction49389870&lt;BR /&gt;"Setup time:1 Create Script_Test:4 End edit:0 Append:195 Wire:277 Total:477"&lt;BR /&gt;MouseTool:ScriptAction49389530&lt;BR /&gt;"Setup time:1 Create Script_Test:3 End edit:0 Append:339 Wire:451 Total:794"&lt;BR /&gt;MouseTool:ScriptAction493891F0&lt;BR /&gt;"Setup time:1 Create Script_Test:3 End edit:0 Append:536 Wire:677 Total:1217"&lt;BR /&gt;MouseTool:ScriptAction49388EB0&lt;BR /&gt;"Setup time:1 Create Script_Test:4 End edit:0 Append:815 Wire:1005 Total:1825"&lt;BR /&gt;OK&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;As you can see, the append and wire phases take nearly double the about of time as the previous iteration. This script only has 5 loops, whereas my full script will do this a few hundred times.  Either I am going about this the wrong way, or something is really busted.  Any ideas?  At the current state of my script, it will probably take a few days to build the entire particle system that I am planning.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;  Ray</description>
      <pubDate>Thu, 09 Jul 2009 17:52:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-pflow-creation-taking-a-long-time/m-p/4103285#M23897</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-09T17:52:23Z</dc:date>
    </item>
    <item>
      <title>Re: scripted PFlow creation taking a long time...</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-pflow-creation-taking-a-long-time/m-p/4103286#M23898</link>
      <description>I found my problem.  I discovered that in a new blank scene that my test script ran in just a few ms.  I started poking around with my scene and I found that if I do a File-&amp;gt;Merge, in addition to the objects that I knew about, there were hundreds of "Particle View" helpers &amp;amp;#40;classof Particle_View.  I presume that these are left over from all of my attempts to write this script.  If I open the scene, I don't see these Particle_View helpers in the Select By Name dialog.  They are not hidden, nor visible in the particle viewer, but are listed in the &amp;amp;#36;objects.  Nuking these helpers fixes my script speed problems.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;BR /&gt;for obj in objects do if &amp;amp;#40;matchPattern obj.name pattern:"Particle View*"&amp;amp;#41; do delete obj&lt;BR /&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I have also noticed that after running my script I can run the above code to delete these Particle_View helpers and it does not break my particle system.  Anyone know why my script creates so many of these?  According to the MaxScript help file, they are "created by Particle Flow when using the particleFlow.OpenParticleView&amp;amp;#40;&amp;amp;#41; method"  I never call the OpenParticleView&amp;amp;#40;&amp;amp;#41;.&lt;BR /&gt;&lt;BR /&gt;-Ray</description>
      <pubDate>Thu, 09 Jul 2009 19:12:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-pflow-creation-taking-a-long-time/m-p/4103286#M23898</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-09T19:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: scripted PFlow creation taking a long time...</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-pflow-creation-taking-a-long-time/m-p/4103287#M23899</link>
      <description>That method is called when you push the button to open a particle view... It usually only makes one per scene... but I've seen more than one in a scene before too...</description>
      <pubDate>Thu, 09 Jul 2009 20:08:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-pflow-creation-taking-a-long-time/m-p/4103287#M23899</guid>
      <dc:creator>keithm</dc:creator>
      <dc:date>2009-07-09T20:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: scripted PFlow creation taking a long time...</title>
      <link>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-pflow-creation-taking-a-long-time/m-p/4103288#M23900</link>
      <description>It's strange how the script in my first post creates 5 of these Particle_View helpers.  When I first discovered these helpers, I had about 760 of them in my scene.</description>
      <pubDate>Thu, 09 Jul 2009 20:31:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/3ds-max-programming-forum/scripted-pflow-creation-taking-a-long-time/m-p/4103288#M23900</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2009-07-09T20:31:20Z</dc:date>
    </item>
  </channel>
</rss>

