PointCache2


An overhauled version of the PointCache modifier that ships with Max4.

Features that are different from the original:


Options:

Back To Top...


MaxScript:

There are two global structs available for use with the modifier: cacheOps and pointCacheMan.

pointCacheMan has a single function: GetUsedMemory(). This will return the amount of memory (in bytes) used by all the preloaded cache files. Caches that aren't pre-loaded aren't taken into consideration.

For cacheOps, the first argument of all the functions is an instance of the PointCache2 modifier that you want to act on, and that modifier must be active in the modifier panel. ie:

obj = Sphere()
AddModifier obj (NoiseModifier scale:20 strength:[20,20,20] animate:true)

pcMod = PointCache2()
pcMod.cachefile = "c:\\temp\\foobar.pc2"
AddModifier obj pcMod

SetCommandPanelTaskMode mode:#modify
modPanel.SetCurrentObject pcMod
cacheOps.RecordCache pcMod
cacheOps.DisableBelow pcMod
The available functions are:
cacheOps.RecordCache <PointCache2Modifier>
Records a cache file. A valid cache filename must be assigned for this to work. Returns true on success or false on failure.
cacheOps.EnableBelow <PointCache2Modifier>
Enables all the modifiers below the specified cache modifier.
cacheOps.DisableBelow <PointCache2Modifier>
Disables all the modifiers below the specified cache modifier.
cacheOps.Unload <PointCache2Modifier>
Frees the current cache file, so it can be edited or deleted externally.
cacheOps.Reload <PointCache2Modifier>
Re-opens the current cache file, if previously unloaded.

Back To Top...


.PC2 File Format:

You can create or modify PointCache2 files by hand using the following file format. The start of the file is a header containing:
char    cacheSignature[12];   // Will be 'POINTCACHE2' followed by a trailing null character.
int     fileVersion;          // Currently 1
int     numPoints;            // Number of points per sample
float   startFrame;           // Corresponds to the UI value of the same name.
float   sampleRate;           // Corresponds to the UI value of the same name.
int     numSamples;           // Defines how many samples are stored in the file.

Be sure to check the version number. If it isn't 1, then don't mess with the file, as the format will change in the future.

Following the header, there is a straight dump of all the cache samples (which are snapshots of all the point positions for an object). Each sample is stored one after the other as a flat array of x/y/z floats for each point (so each sample is (numPoints * sizeof(float) * 3) bytes).

See the included "PointCacheWriter.ms" script as an example.

Back To Top...


Known Bugs/Limitations:

Back To Top...


History:

2000.12.13 - Created.
2001.01.25 - Released.
2001.01.29 - Added "Apply To Spline".
2001.04.25 - For convenience, the object name is now the default cache name when creating a new cache.
           - Replaced "Delete Cache File" button with safer "Browse Cache Dir".
           - Reduced cache file locking problems (can usually delete cache now without exiting Max).
           - Cache header is no longer read on cache overwrite.
2001.05.10 - Unload/Reload
           - Default to current cache dir when hit "Load..."
2002.12.11 - Added playback_original and playback_start playback types
           - Removed notification of missing pointcache files in R5 (covered by Missing Map dialog in R5)
2002.12.12 - Speedup: Only reads the two extra cubic samples when using cubic interpolation now (duh)
             (not cubic interpolation is still fairly unsupported and possibly broken)
           - Should be better at catching when to close cache files.
           - Removed "Apply To Spline" from UI (not too useful anymore).
2002.12.13 - Added Cache PreLoading
           - Fixed bug with caches simply not loading when large numbers of caches were active.
2002.12.14 - Sped up recording to network again
           - Fixed UI flickering issue in R5
2002.12.19 - Added "Clamp Graph" to support looping playback better.
2003.01.15 - Check for invalid characters when basing initial cache filename after node name.
2003.02.12 - Bugfixes.
2003.03.07 - Bugfixes.
2003.06.04 - Added "Force UNC Path" option.

Back To Top...


Bug reports/comments/suggestions: foo@footools.com