Avguard Extensions - Version 4.0.2
Requires 3dsmax R4.2

Change notes:
v4.0.1	- Initial public release.
v4.0.2	- added: isDeformable, numPoints, getPoint, nodeGetBoundingBox, nodeLocalBoundingBox

Methods:

  avguardHelp()
      A quick summary of the methods and variables defined by this extension.

  WSMApplyFC <WSM_node_array> <pos_point3_array> <vel_point3_array> <force_point3_array> interval:<interval> stepsize:<time> 
	Applies force-field (Particles & Dynamics + Displace) and deflector (Particles Only) type Space Warps to 
	the position, velocity, and force array values. The position values are in MAX units, the velocity values 
	are in MAX units/tick, the force values are in Max units/tick^2 (mass assumed to be == 1). The position, 
	velocity, and force arrays must be the same size. The effects of the space warps are evaluated over the 
	specified interval, with a default interval of (interval currenttime (currenttime+1f)), using the specified 
	stepsize, with a default of 1 frame. The effect of the force-field space warps are first evaluated in the 
	order specified, followed by the deflector space warps in the order specified. The values in the position, 
	velocity, and force arrays are replaced with the results of the evaluation of the effects of the space 
	warps. The supplied force values are applied prior to the space warps being applied. Normally you 
	want to set the force array to contain values of [0,0,0] prior to calling this method. Only if you are 
	calculating an additional force in your script would you set the force array to other values. The position 
	and velocity arrays would normally contain the results of the last call to this method. Any force-field 
	space warp, including 3rd party plugins, should work correctly. Only the deflector space warps that ship 
	with MAX are supported. The Path Follow space warp is not suppported as it requires a particle system.

	Example usage (assuming an appropriately placed Gravity and Deflector space warp):

	posArray=#([10,0,0],[10,10,0])
	velArray=#([0,0,0],[0,0,0])
	for i = 0 to 20 do
	(	forceArray=#([0,0,0],[0,0,0])
		point pos:posArray[1] 
		point pos:posArray[2] 
		at time i WSMApplyFC #($gravity01,$deflector01) posArray velArray forceArray
	)
	point pos:posArray[1] 
	point pos:posArray[2] 

	Note: Thinking about adding a 'collided' named parameter that takes a bitArray value, and have the method
	set the corresponding bit if a collision has occurred. Also a 'stopAtCollision' named parameter that, if 
	set to true, would stop evaluating the interval when a collision is detected. The current return value 
	for this method is always 'ok', but would be changed to the time at which the first collision occurred or
	undefined if no collision occurred. Also, possibly allow the <pos_point3_array> to be an array of point3
	controllers and set keys for the controllers at each timestep. Probably would need to also specify an 
	offset transform, since the position values need to be in world space.

  WSMSupportsForce <node>
	Returns true if the specified node can be used as a force-field type space warp for WSMApplyFC.

  WSMSupportsCollision <node>
	Returns true if the specified node can be used as a deflector type space warp for WSMApplyFC.

  quatToEuler <quat> order:<eulertype_integer>
  eulerToQuat <eulerAngle> order:<eulertype_integer>
	Convert between quat and euler angle values. The optional order parameter specifies the order of 
	application of the angles. If not specified, XYZ ordering is used. Its value can be any of the 
	following:
		1 - XYZ
		2 - XZY
		3 - YZX
		4 - YXZ
		5 - ZXY
		6 - ZYX
		7 - XYX
		8 - YZY
		9 - ZXZ

  quatToEuler2 <quat>
	Returns the same Euler value as is shown in the TTI for the quat

  quatArrayToEulerArray <quat array>
	Returns an array of smooth Euler values for the quat array.

  close_enough <float> <float> <int>
	Returns true if the two <float> values are approximately equal, where increasing values of <int>
	increase the range defined as appoximately equal. A good value of <int> in most cases is 10.

	Example:

	for d1 in #(1., 10., 100., 1000.) do
	( print d1
	  for i = 0 to 8 do
	  ( d2 = d1+(d1*10.^(-i))
	    format "% : % : % : % : %\n" i d1 d2 (d1==d2) (close_enough d1 d2 10)
	  )
	)

  appendIfUnique <array> <value>
	Appends the value to the array if the value is not already in the array. Returns true if
	the value is added, false if not.

  pasteBitmap <src_bitmap> <dest_bitmap> (<src_box2> | <src_point2>) <dest_point2>
	Copies a block of pixels from src_bitmap to dest_bitmap. Position of source block is
	specified by src_box2 or src_point2, and the destination by dest_point2. The width and
	height of the block is specifed by src_box2 or, if src_point2 is specified, by the
	remaining size of the source bitmap. The width and height will be clamped to prevent 
	either source or target overruns. Only RGBA information is copied - no channel data 
	is copied.

	Example:

	bm1=bitmap 100 100 color:red
	bm2=bitmap 100 100 color:green
	display bm1
	display bm2
	pasteBitmap bm1 bm2 [50,50] [50,50]
	display bm2

  weldSpline <splineShape node> <tolerance>
	Welds the selected knots in the specified splineShape that are within the specified 
	tolerance.

  getclipboardText()
  setclipboardText <string>
	Get/Set the text string in Window's clipboard. getclipboardText returns a string value, or 
	undefined if the clipboard does not contain a string. setclipboardText returns if the string
	was successfully placed in the clipboard, false if not.
	
  setclipboardBitmap <bitmap>
  getclipboardBitmap()
	Get/Set the bitmap in Window's clipboard. getclipboardBitmap returns a bitmap value, or 
	undefined if the clipboard does not contain a bitmap. setclipboardBitmap returns if the bitmap
	was successfully placed in the clipboard, false if not.

  getLocalTime()
  getUniversalTime()
	Returns the local or Coordinated Universal Time (UTC) as an 8 element array. Array elements 
	are:
	1. Year - Specifies the current year. 
	2. Month - Specifies the current month; January = 1, February = 2, and so on. 
	3. DayOfWeek - Specifies the current day of the week; Sunday = 0, Monday = 1, and so on. 
	4. Day - Specifies the current day of the month. 
	5. Hour - Specifies the current hour. 
	6. Minute - Specifies the current minute. 
	7. Second - Specifies the current second. 
	8. Milliseconds - Specifies the current millisecond. 

  isDeformable <node> 
	Returns true if the node's object is deformable

  numPoints <node>
	Returns the number of deformable points for the node's object

  getPointPos <node> <index>
	Returns the position of the indexed point for the node's object. Position is returned in current
	coordinate system.

  nodeGetBoundingBox <node> <matrix3>
	Returns a 2 element array containing the min and max points of the node's bounding box in coordinate system
	matrix3 as point3 values. Positions returned are always in the specified matrix3 coordinate system.

	Example: 
	Create a teapot and a camera (turn on Orthographic Projection). Run:
	bb= nodeGetBoundingBox $teapot01 $camera01.transform
	in coordsys $camera01 point pos:bb[1]
	in coordsys $camera01 point pos:bb[2]

	Note that this does not correct for the camera's FOV

  nodeLocalBoundingBox <node>
	Returns a 2 element array containing the min and max points of the node's local bounding box. Positions returned are
	in the current coordinate system,
	
	Example: 
	Create a teapot. Run:
	bb= nodeLocalBoundingBox $teapot01
	point pos:bb[1]
	point pos:bb[2]

  intersectRayScene <ray>
	Performs intersectRay on all nodes in the scene. Returns an array of results, one entry per node hit, where each
	entry is a 2 element array containing the node and the intersectRay result for that node.

Global Variables:

  avguard_dlx_ver 
	read only system global - the version number of this plugin as <string> value


snapMode structure variables and methods:

  snapMode.hilite
	The snap marker color as a <color>

  snapMode.markSize
	The snap marker size as an <integer>

  snapMode.toFrozen
	Whether to snap to frozen objects as a <boolean>

  snapMode.axisConstraint
	Whether the snap should use axis constraints as a <boolean>

  snapMode.display
	Whether the snap marker is displayed as a <boolean>

  snapMode.strength
	The snap strength as an <integer> - read only.

  Following snapMode variables/methods return undefined if snap not active.

  snapMode.hit
	Whether currently snapped to something - read only.

  snapMode.node
	The node currently being snapped - read only.

  snapMode.flags
	The snap system flags as an <integer> - read only.

  snapMode.hitPoint
	The last snap point as <point3> coordinate in local coordinates of node snapped to - read only.

  snapMode.worldHitpoint
	The last snap point as <point3> world coordinate - read only.

  snapMode.screenHitPoint
	The last snap point as <point3> screen coordinate - read only.

  snapMode.OKForRelativeSnap
	True if at least one snap point has been recorded - read only.

  snapMode.refPoint
	The last snap point as <point3> world coordinate - read only.

  snapMode.topRefPoint
	The first snap point as <point3> world coordinate - read only.

  snapMode.numOSnaps
	The number of OSnaps as an <integer> - read only.

  snapMode.getOSnapName <int osnap_index>
	Returns the name of the indexed OSnap as <string>

  snapMode.getOSnapNumItems <int osnap_index>
	Returns the number of OSnap items in the indexed OSnap as <integer>

  snapMode.getOSnapItemName <int osnap_index> <int osnap_item_index>
	Returns the name of the indexed OSnap item in the indexed OSnap as <string>

  snapMode.getOSnapItemToolTip <int osnap_index> <int osnap_item_index>
	Returns the tooltip of the indexed OSnap item in the indexed OSnap as <string>

  snapMode.getOSnapItemActive <int osnap_index> <int osnap_item_index>
	Returns true if the indexed OSnap item in the indexed OSnap is active, false otherwise

  snapMode.setOSnapItemActive <int osnap_index> <int osnap_item_index> <boolean>
	Sets whether the indexed OSnap item in the indexed OSnap is active

	Examples:

	for i = 1 to snapmode.numOSnaps do
	(	format "%: name: \"%\"\n" i (snapmode.getOSnapName i)
		for j = 1 to (snapmode.getOSnapNumItems i) do
			format "   %: name: \"%\"; tooltip: \"%\"; state: %\n" j (snapmode.getOSnapItemName i j) \
			                    (snapmode.getOSnapItemToolTip i j) (snapmode.getOSnapItemActive i j)
	)

	snapmode.getOSnapItemActive 5 1
	snapmode.setOSnapItemActive 5 1 (not (snapmode.getOSnapItemActive 5 1))
	snapmode.getOSnapItemActive 5 1

	format "type: %; hilite: %; marksize: %; toFrozen: %\n" snapmode.type snapmode.hilite \
			snapmode.markSize snapmode.toFrozen
	format "axisConstraint: %; active: %; strength: %\n" snapmode.axisConstraint snapmode.active \
			snapmode.strength

	fn snapinfo = 
	(	local snapinfo
		if snapmode.active do
		(	struct snapinfo (hit, flags, hitpoint, worldhitpoint, screenHitPoint, OKForRelativeSnap, 
							topRefPoint, refPoint, node)
			local out = snapinfo snapmode.hit (bit.intAsHex snapmode.flags) snapmode.hitPoint \
						snapmode.worldHitpoint snapmode.screenHitPoint snapmode.OKForRelativeSnap \
						snapmode.refPoint snapmode.topRefPoint snapmode.node
			print out
		)
	ok
	)
	registerRedrawViewsCallback snapinfo
	-- unregisterRedrawViewsCallback snapinfo


mouse structure variables:

  mouse.inAbort
	TRUE if any mouse proc is currently in the process of aborting; otherwise FALSE - read only.

persistents structure methods:

  persistents.gather()
	Returns array of persistent global variable names as <name> values

  persistents.make <global var name>
	Makes the specified global variable name persistent. The name specified must be a global 
	variable's name, or else a runtime error is thrown. See globalVars structure.

  persistents.ispersistent <global var name>
	Returns true if the specified global variable name is persistent. The name specified need
	not be a global variable's name.

globalVars structure methods:

  globalVars.get <global var name>
	returns the value of the specified global variable
  globalVars.set <global var name> <value>
	sets the value of the specified global variable
  globalVars.gather()
	returns array of global variable names
  globalVars.isglobal <var name>
	returns true if the specified variable name is global

  TCBDefaultParams.tension
  TCBDefaultParams.continuity
  TCBDefaultParams.bias
  TCBDefaultParams.easeTo
  TCBDefaultParams.easeFrom
	Get/set the default TCB key parameters. New TCB controller keys will be created with this value.

  BezierDefaultParams.inTangentType
  BezierDefaultParams.outTangentType
	Get/set the default Bezier key in and out Tangent Type. Valid values are: 
	#smooth | #linear | #step | #fast | #slow | #custom
