Announcement

Collapse
No announcement yet.

Maxscript: when dos the sim end!

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Maxscript: when dos the sim end!

    Hi,
    Im converting one of my fumeFX network sim/render scripts to support Phoenix and I need to be able to start the sim via maxscript (no probs here, A_StartSim $).. But I also need to find out when the sim stops.
    With FumeFX the next line of code only executes after the sim has finished, but Phoenix is more interactive and executes it immediately!
    How do I get around this?


    edit:
    I could redefine the OnSimulationEnd function and check the use script check box but I would rather not change this in-case its being used to to other stuff..
    Also does having useScript turned on slow down the simulating like it does with FumeFX (multitasking disabled when using maxscript in simulation)

    (
    A_StartSim $
    fn OnSimulationEnd = (print "Finished")
    )
    Last edited by jordanw; 28-10-2010, 08:17 PM.
    Jordan Walsh
    Senior FX artist

    Showreel 2010 (new)
    Check out my scripts at Script Spot!

  • #2
    unlike the fume, phoenix does not block the max during the sim and this is the reason why the next instruction is executed immediately after the start. the script can be used without any measurable slowing down, of course only if no action is executed in OnSimulationStep. and to the question - i think there is no other way, OnSimulationEnd is made for this purpose. if you are afrayd that it could be used for other stuff (wrom who?) you can try to keep its content (if max script is able to do this) and to redefine it after that, calling at the end the old function.
    ______________________________________________
    VRScans developer

    Comment


    • #3
      Ok. Storing the OnSimulationEnd function works fine. My other problem is that im trying to get phoenix to simulate on the network using deadline as a maxscript job.As far as I can tell this isnt possible as the maxsript code finishes and deadline believes the job is done when Phoenix has just started simming. It seems to me there needs to be a simming mode that is non interactive so simming jobs can be done in deadline or done with a batch maxscript.
      This is the kind of thing I was attempting:
      Code:
      (
      	result = undefined
      	A_StartSim $
      	tempOnSimulationEnd = OnSimulationEnd
      	fn OnSimulationEnd =
      	(
      		tempOnSimulationEnd
      		result = true
      	)
      	--while result != true do sleep 1 --This was supposed to wait untill the sim has finished then resume the script, but just locks up max.
      	
      	--Id like to do some other stuff here when the simulation has finished
      	print result --deadline now knows that the job has finished
      )
      Jordan Walsh
      Senior FX artist

      Showreel 2010 (new)
      Check out my scripts at Script Spot!

      Comment


      • #4
        you are trying to organize the whole process as a continuous sequence of code, like in the good old times
        if the max hangs when sleep is executed, then i'm afraid with phoenix this is impossible and you have to use the event driven concept. this means - replace result=true with the real action that you need to be executed after the simulation. for example, if you need to start the rendering, just start it in OnSimulationEnd, do not use a flag and do not perform pending over this flag.
        ______________________________________________
        VRScans developer

        Comment


        • #5
          I would love to do all my processing in the OnSimulationEnd but network simulation using Deadline wont allow this as it waits for the script to finish then the network will force quit max thinking that the job has completed, probably before the first frame is even simulated. That is why I setup the example code as I did.
          Phoenix will not be very production friendly with out some way to achieve network simulation or batch simulation. Im am doing some RnD for a large job and this type of functionality would be vital, especially with deadline!
          What are your plans for network/batch simulation?
          Jordan Walsh
          Senior FX artist

          Showreel 2010 (new)
          Check out my scripts at Script Spot!

          Comment


          • #6
            ok, i will try to do something for this
            ______________________________________________
            VRScans developer

            Comment


            • #7
              ok, i just made a new script function, that can wait the end of the simulation, keeping the whole max alive. this can be very confusing, because the function blocks, but the max is alive and you can change the script calling the function, or some other mad things the function is named a_wait and will be available in the next build
              ______________________________________________
              VRScans developer

              Comment


              • #8
                Great! This will be very useful! Thanks
                Jordan Walsh
                Senior FX artist

                Showreel 2010 (new)
                Check out my scripts at Script Spot!

                Comment


                • #9
                  How does one use A_wait? Some example would be nice!!

                  Okay. I found it in the documentation of PhoenixFD. Sorry.

                  A_StartSim $PhoenixFD001
                  -- this holds the script execution.
                  A_wait $PhoenixFD001
                  -- after simulation finishes, the next lines are executed.
                  print "finished!"
                  [...]
                  Last edited by 48design; 27-04-2012, 04:19 AM. Reason: found it... ;o)
                  zwischendrin.com - HDRI panoramas, HD textures, stock images, SFX and more

                  Comment


                  • #10
                    Is there any MXS inteface to the restore button? The reason I ask is that I was simming a 55million cell job on our farm when all of a sudden the sim broke for some reason and started simming only 5K files. restoring from the last good frame from a local machine worked fine but there doesnt seem to be a way to get a farm job to do the same... Any ideas?

                    Dave

                    Comment


                    • #11
                      You can try tomorrow's nightly build for this functionality. If you don't have access to the nightlies, ask the support

                      Restore will be done with the A_StartSim() function. It takes three parameters, two of them are optional:
                      node:<Simulator>
                      [cache: <String>]
                      [startframe: <integer>]

                      Passing just the simulator node will start a new simulation.

                      If you pass the path to a cache file, the effect will be that of the Load button - the simulation state will be loaded from the cache and the simulation will continue from the Starting Frame (parameter in the Simulation rollout).

                      And if you manually pass the startframe index too, it takes precedence over the Load function and the simulation will be RESTORED from the given frame, the same way that the Restore button works.

                      Also, this function will decide between simulation and re-simulation depending on the state of the Particle Resimulation and Grid Resimulation switches
                      Svetlin Nikolov, Ex Phoenix team lead

                      Comment

                      Working...
                      X