Moving the timeline pointer back to frame 1 with xsibatch


UPDATE: In the comments, Vladimir suggests a better way to do this: use the scntoc. That way, the scene will always open at frame 1.
Use a text editor to add Application.SetValue(“PlayControl.Current”, 1) to the onload script. This script will run when you open the scene, and move the timeline pointer back to frame 1 to avoid the re-simulation.

   <PostLoadScript>
      <Language>Python</Language>
      <Function>postLoad</Function>
      <Script_Content>
	<![CDATA[
Application.SetValue("PlayControl.Current", 1)
	]]></Script_Content>
   </PostLoadScript>

After you save the scene, Softimage will write out the scntoc without the CDATA section (Softimage will replace special characters like < and ” with entities).

   <PostLoadScript>
      <Language>Python</Language>
      <Function></Function>
      <Script_Content>
	
Application.SetValue(&quot;PlayControl.Current&quot;, 1)</Script_Content>
   </PostLoadScript>


So you have a heavy simulation, and you saved the scene with the timeline pointer at frame 1000. Now when you open the scene, you have to sit and wait while the scene re-simulates.

You can fix this by using xsibatch to move the timeline pointer back to frame 1.

It’s probably a good idea to save heavy sim scenes with the timeline pointer at frame 1 😉

  • Save this JScript in a .js file.
    var sScene = "C:\\Users\\blairs\\Support\\Scenes\\Test.scn"
    OpenScene(sScene, null, null);
    SetValue("PlayControl.Current", 1, null);
    SaveScene();
    
  • In a command prompt, use xsibatch -processing -script to run the script:
    xsibatch -processing -script C:\Users\blairs\Documents\resetPlayControlCurrent.js
    

Now you can open your scene without it resimulating.

5 thoughts on “Moving the timeline pointer back to frame 1 with xsibatch

  1. Nice, thanks for the tip!

    It would be nice to have timeline pointer exposed in .scntoc file. That would be even simpler!

    Well.. just a thought anyways 😉

  2. Hi,
    well this is one good way of doing this but I think there is a better one 🙂 The problem with your setup is that one would have to execute the batch command every time you save a scene that is not on frame 1. Another way of doing this and going sure that whenever you open the scene it will be on frame 1, is to edit your scntoc file.
    -First you have to make sure that scntoc is enabled in the Preferences under “Data Management”
    -Then just edit your scntoc file to something like this:

       <PostLoadScript>
          <Language>Python</Language>
          <Function>postLoad</Function>
          <Script_Content>
    	<![CDATA[
    Application.SetValue("PlayControl.Current", 1)
    	]]></Script_Content>
       </PostLoadScript>
    

    Make sure that you set the language right.

    hope this is of any help
    Vladimir

    • Ok, that is a better way. I wrongly assumed “post load” meant that the script would run after the scene was loaded and the sim evaluated…I should have tried it. Thanks!

Leave a comment