randomize frame offset


#1

Is there a way to duplicate the xmesh loaders and randomize the offset for each one. Couldnt find much in documentation for scripting with xmesh loader. So i used maxscript listener to see what it gave me when i changed the frame offset value. I tried to write a basic script, it didnt work :confused: not too good at scripting yet.


#2

This should have worked just fine, assuming you COPIED the XMesh Loaders and did not instance then.
You can write the same in one line, like

for o in selection do o.frameOffset = random 0 30

To see all properties of the XMesh Loader, just select one of them and enter

show $
  .showIcon : boolean
  .iconSize : worldUnits
  .meshScale : float
  .keepMeshInMemory : boolean
  .writeVelocityMapChannel : boolean
  .velocityMapChannel : integer
  .renderSequence : filename
  .proxySequence : filename
  .autogenProxyPath : boolean
  .loadSingleFrame : boolean
  .frameOffset : integer
  .limitToRange : boolean
  .rangeFirstFrame : integer
  .rangeLastFrame : integer
  .enablePlaybackGraph : boolean
  .playbackGraphTime : float
  .beforeRangeBehavior : integer
  .afterRangeBehavior : integer
  .loadMode : integer
  .enableViewportMesh : boolean
  .enableRenderMesh : boolean
  .renderSequenceID : integer
  .viewportSequenceID : integer
  .displayMode : integer
  .displayPercent : float
  .useFileLengthUnit : boolean
  .lengthUnit : integer
  .ignoreMissingViewportSequenceOnRenderNode : integer
false

If your offset goes outside of the available range, you might have to enable the custom range option (.limitToRange=true), and specify .rangeFirstFrame and ,rangeLastFrame to avoid errors when a frame is requested that does not exist.

Please let us know what did NOT work in your attempt, as I just did it and it works just fine hereโ€ฆ


#3

Thanks Bobo! :slight_smile: Eloi helped me and I got it working with this:

for i in 1 to selection.count do
(
$[i].frameOffset = random 10 20
)