Announcement

Collapse
No announcement yet.

Secondary Cache location/backup after simulating

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

  • Secondary Cache location/backup after simulating

    Hi all,

    I'm currently simming locally and then copying my cache to our servers for the render farm - obviously this involves a bit of manual work or scripting.

    Would it be possible to add a "backup cache" location where the .aur files could be copied to once simulating has finished, or even a secondary input path so that if the primary cache is not found (because it was saved locally and then backed up to a server) then the secondary path would be used.

    I was considering setting this up via maxscript (if possible) but thought that other users may find it useful. Of course if something similar already exists then I would love to know where!

    Cheers

  • #2
    Why not just write cache to shared server? it doesn't have to be 'local' . Helps if you always address as UNC

    Comment


    • #3
      Writing to a network location is slower than a local drive, which in turn makes phoenix take longer before it can start the next frame. Writing huge cache files can also cause a slowdown for other users on the network.

      Comment


      • #4
        Ah, negative - such functionality does not exist yet - if you can script it yourself, please go ahead!
        Svetlin Nikolov, Ex Phoenix team lead

        Comment


        • #5
          So I managed to cobble something together but I've run into a bit of an issue.

          In the OnSimulationEnd I created a variable for the original cache path (on the network drive) and created an array of the files using GetFiles.
          Whenever I add the following code:
          Code:
          for i in OriginalFiles do
          (
          deleteFile I
          )
          I get the error message
          Code:
          -- Security Exception: MAXScript command embedded in the current scene could be unsafe and its execution has been blocked for the current 3ds Max session: deleteFile "C:\Users\USER\Desktop\tempCache\test_0000.aur"
          Is there any way to tell max that the running code is safe? Otherwise when I try to copy the new/local files to the network it fails as the files already exist (albeit as an older version). I can manually clear the network cache before running the sim or manually copy them over later but that kind of defeats the point haha.

          Comment


          • #6
            Ah dang, this thing.

            Check out this topic: https://knowledge.autodesk.com/suppo...8A2F1-htm.html

            Also, the deleteFile function is mentioned below in https://knowledge.autodesk.com/suppo...67D64-htm.html

            One "solution" would be to turn off the 'Safe Scene Script Execution' from the Preferences, but is this an option for you?
            Svetlin Nikolov, Ex Phoenix team lead

            Comment


            • #7
              Hey Svetlin.

              Probably a negative on the above. Mostly it's just me using the script in the studio so remembering to delete my existing cache on the network isn't a huge problem to remember.

              Another issue that I am running into is that when I try simulating with my "set cache to local drive" script, it fails if I have just opened the scene but if I open the phoenix script window and replace the text (with the exact same code) it works again. Any idea why this might be?

              I don't have the exact error to hand but it was something along the lines of
              Code:
              unexpected exception: this = undefined

              Comment


              • #8
                Oh, how can I have this error show up here as well? Is your code not running on one of the OnSimulationBegin/End/etc Phoenix callbacks?
                Svetlin Nikolov, Ex Phoenix team lead

                Comment


                • #9
                  Hey, the exact error I'm getting is this:
                  Code:
                  -- MAXScript ExecuteMAXScriptScript Exception:
                  -- Type error: Call needs function or class, got: undefined
                  -- MAXScript callstack:
                  --    thread data: threadID:12548
                  --    ------------------------------------------------------
                  --    [stack level: 0]
                  --    In top-level
                  -- MAXScript ExecuteMAXScriptScript Exception:
                  -- Type error: Call needs function or class, got: undefined
                  -- MAXScript callstack:
                  --    thread data: threadID:12548
                  --    ------------------------------------------------------
                  --    [stack level: 0]
                  --    In top-level
                  ​
                  I did wonder if it was because I was doing
                  Code:
                  local sim = this
                  before the OnSimulationBegin function, but I have also tried defining Local sim = "" at the start of the script and then sim = this from within the OnSimulationBegin function, but this doesn't seem to help.

                  I also discovered that it turns out I don't need to re-copy the code in, but rather run the sim a second time and the code works. Very odd.

                  Comment


                  • #10
                    Ah, so the "this" object is set to the actual Simulator object right before OnSimulationBegin(), OnSimulationStep() and OnNewFrame() are called.

                    Also, the entire script in the Phoenix maxscript editor gets executed once when the simulation is started, after "this" is set, but before OnSimulationBegin() is called.
                    Svetlin Nikolov, Ex Phoenix team lead

                    Comment


                    • #11
                      Is the "local sim = this" code in a function that you are calling before OnSimulationBegin()?

                      Asking because 3ds Max will error out that it needs to be "global sim = this" if it's simply at the top of the Phoenix maxscript file.

                      Sorry if I am asking about small things, but I need to understand better what is happening
                      Svetlin Nikolov, Ex Phoenix team lead

                      Comment


                      • #12
                        Hi Svetlin,

                        Looking at my original, it looks like I'm calling "local sim = this" before the OnSimulationBegin function. I think in my test yesterday I had modified it to
                        Code:
                        local sim = ""
                        before any of the callbacks and then
                        Code:
                        sim = this
                        within the OnSimulationBegin callback, but I think I had the same error.
                        If I get the chance I'll try to test today and get you a proper answer

                        Sorry if I am asking about small things
                        Not at all! I'm an artist first and scripter second so there's bound to be bugs in my code haha.

                        Comment


                        • #13
                          Ah, does "global sim = this" throw any errors?
                          Svetlin Nikolov, Ex Phoenix team lead

                          Comment

                          Working...
                          X