ZBrushCentral

History actions

Is there a way to find out what commands are stored in the history steps?

For example I need to run a script but it should only be run directly after QRemesher has been run. I need to check to see if it’s the last command in the history and if not it won’t run the script.

Hope that makes sense.

The undo history is not available to zscript that way. I can’t think of a fail-safe way of checking if QRemesher has run. However, it does use a file that you can check for when it was last updated and use that to make a ‘best guess’.

This code snippet ilustrates what I mean. Note that the path to the Public folder may vary between users (and it will be different on the Mac), and you should check that the file you are looking at actually exists. Also, I just check to see if the time in hours and minutes are the same - you might want to increase the accuracy of this.


[IButton,HasQRemesherRun,,
  //check the memblock isn't around
  [MemDelete,MC_Test]
  //create a memory block
  [MVarDef,MC_Test,10,0]
  //save it to the file
  [MemSaveToFile,MC_Test,"TestFile.dat",1]
  //delete the memblock
  [MemDelete,MC_Test]
  //get the time test file was modified
 [VarSet,fHrs,[FileGetInfo, [FileNameResolvePath,"TestFile.dat"],11]]
 [VarSet,fMins,[FileGetInfo, [FileNameResolvePath,"TestFile.dat"],12]]
    //get the time the QRemesher file was last modified
  [VarSet,qRHrs,[FileGetInfo, "C:\Users\Public\Documents\ZBrushData\Temp\objOut.obj",11]]
  [VarSet,qRMins,  [FileGetInfo, "C:\Users\Public\Documents\ZBrushData\Temp\objOut.obj",12]]

//compare the result
  [If,((qRHrs == fHrs)&&(qRMins == fMins)),
    [Note,"QRemesher was just run"]
    ,
    [Note,"QRemesher not used recently"]
  ]
]