jbLib is a MaxScript extension that contains a collection of new functions for use in MaxScript.
The current version is 7. This is defined in a global read-only variable jbLibVersion
, which you can use to check that jbLib.dlx is installed and up-to-date for your script. If you use these functions, it is encouraged that you wrap your script in an if
statement that does these checks, and gracefully bails if they fail. ie:
if (
local requiredVer = XXX
local str, failed = FALSE
if (jbLibVersion == undefined) then (
failed = TRUE; str = "This script requires jbLib.dlx to run properly."
) else if (requiredVer > jbLibVersion) then (
failed = TRUE; str = "The installed version of jbLib.dlx is out of date."
)
if (failed) then (
str += "\n\nYou can get the latest version at http://www.footools.com/.\n\nWould you like to connect there now?"
if (QueryBox str title:"Error") then ( try (ShellLaunch "http://www.footools.com/" "") catch () )
FALSE
) else ( TRUE )
) then (
... -- your script body goes here
)
Important: replace "XXX
" in the "local requiredVer = XXX
" line above with the current value of jbLibVersion
at the time you write the script. This way, your script becomes "locked" to require the jbLib version you're currently using.
If your script is a macroscript, the script body would be wrapped inside the above if
statement, and the macroscript definition (the "macroScript myMacro category:"MyCategory""
lines) would go around all of the above.
ApplyVertexColors <collapsedMesh> <lightModel> <doMix> <castShadows> <useMaps>
TRUE
on success, otherwise FALSE
.collapsedMesh
must be a collapsed editable mesh node, with no modifiers applied.lightModel
is an integer, where 0 is "Scene Lights" and 1 is "Diffuse".DeleteDirectory <pathName>
ElementFromFace <meshObject> <faceIndex>
EscapeHit
TRUE
if the escape key has been hit since the last time function has been called, otherwise FALSE
.TRUE
even if max does not have window focus.FALSE
, and forget to call this function inside your main loop, at which point max will appear to have crashed (since you can't break out of the loop by holding escape).
escapeEnable = FALSE
do (
-- your code here
) while NOT EscapeHit()
escapeEnable = TRUE
EvalTextureColorPoint <texture> <XYZ> <UVW>
GetClosestVertex <meshObject> <point3>
GetHitDistances <meshObject> <point3 p1> <point3 p2>
p1
and p2
).IntersectRay
, but returns all hit points along the "ray" instead of just the front-most.GetRegistrySetting <rootKeyName> <keyPath> <valueName>
SetRegistrySetting <rootKeyName> <keyPath> <valueName> <value>
rootKeyName
can be one of:
#HKEY_CLASSES_ROOT
#HKEY_CURRENT_CONFIG
#HKEY_CURRENT_USER
#HKEY_LOCAL_MACHINE
(Get only)
#HKEY_USERS
(Get only)
keyPath
is the full path to the key in question. (ie. "Software\\Microsoft\\Internet Explorer"
)valueName
is the name of the value in question (ie. "Download Directory"
)value
is the value to be set (ie. "C:\\MyDownloads"
)Get
is the value in question, or undefined if it doesn't exist.Set
is true
on success.try()catch()
block.GetSpaceWarpForce <spaceWarpNode> <point3>
SpaceWarpSupportsForce
to check if the given spacewarp will work or not.GetUNCPath <filenamePath>
undefined
if the path can't be converted (ie. is a local drive).IsActive <atmospheric | effect>
IsParticleSystem <node>
MoveFile <oldName> <newName>
oldName
and newName
must be full paths, including the filename). TRUE on success, otherwise FALSE.scanlineRenderEx struct
antiAliasing (boolean)
shadows (boolean)
mapping (boolean)
filterMaps (boolean)
forceWireframe (boolean)
autoReflect (boolean)
imageMotionBlur (boolean)
objectMotionBlur (boolean)
wireThickness (float, write only)
autoReflectLevels (integer, write only)
objectBlurDuration (float, write only)
objectBlurSubdivisions (integer, write only)
objectBlurSamples (integer, write only)
imageBlurDuration (float, write only)
SpaceWarpSupportsForce <spaceWarpNode>
GetSpaceWarpForce
function.