3ds Max C++ API Reference
maxscript.h File Reference
#include "../WindowsDefines.h"
#include <stdlib.h>
#include <stdio.h>
#include <float.h>
#include <math.h>
#include "ScriptSource.h"
#include "../ISceneScriptSecurityManager.h"
#include "ScripterExport.h"
#include "kernel/exceptions.h"
#include "kernel/interupts.h"
#include "../strbasic.h"
#include "../ref.h"
#include "../DefaultActions.h"
#include "../dllutilities.h"
#include "../iFnPub.h"
#include "../IParamm2.h"
#include "kernel/value.h"
#include "util/sceneio.h"
#include "foundation/arrays.h"
#include "foundation/hashtable.h"
#include "foundation/name.h"
#include "foundation/streams.h"
#include "foundation/strings.h"
#include "foundation/functions.h"
#include "compiler/thunks.h"
#include "kernel/MAXScript_TLS.h"
#include "macros/value_locals.h"
#include "kernel/MaxscriptTypedefs.h"

Classes

struct  message_box_data
 
struct  message_box_data_ex
 
class  mxs_notify_ref_data
 
class  ScopedErrorTracebackDisable
 Class that uses the RAII idiom to push/pop the error traceback disable state. More...
 
class  MAXScriptPrefs
 
class  ActiveXLicensor
 
class  TempQuietMode
 
class  TempBitmapManagerSilentMode
 
struct  mxs_value_id_pair
 

Namespaces

 MAXScript
 

Macros

#define WIN32_LEAN_AND_MEAN
 
#define NOT_SUPPORTED_BY_PRODUCT(fn)    throw RuntimeError (_M("Feature not available: "), _M(#fn));
 
#define END   NULL
 
#define MAXSCRIPT_UTILITY_CLASS_ID   Class_ID(0x4d64858, 0x16d1751d)
 
#define MAX_SCRIPT_DIR   _M("scripts")
 
#define SCRIPT_AUTOLOAD_DIR   _M("Startup\\")
 
#define no_mb_chars   (MB_CUR_MAX == 1)
 
#define bytelen(s)   strlen(s)
 
#define MXS_ADD_ROLLOUT_PAGE   (WM_USER + 0x100)
 
#define MXS_DELETE_ROLLOUT_PAGE   (WM_USER + 0x101)
 
#define MXS_REDRAW_VIEWS   (WM_USER + 0x102)
 
#define MXS_EDIT_SCRIPT   (WM_USER + 0x103)
 
#define MXS_NEW_SCRIPT   (WM_USER + 0x104)
 
#define MXS_DISPLAY_BITMAP   (WM_USER + 0x105)
 
#define MXS_ERROR_MESSAGE_BOX   (WM_USER + 0x106)
 
#define MXS_PRINT_STRING   (WM_USER + 0x107)
 
#define MXS_LISTENER_EVAL   (WM_USER + 0x108)
 
#define MXS_MESSAGE_BOX   (WM_USER + 0x109)
 
#define MXS_INITIALIZE_MAXSCRIPT   (WM_USER + 0x10A)
 
#define MXS_KEYBOARD_INPUT   (WM_USER + 0x10B)
 
#define MXS_SHOW_SOURCE   (WM_USER + 0x10C)
 
#define MXS_TAKE_FOCUS   (WM_USER + 0x10D)
 
#define MXS_STOP_CREATING   (WM_USER + 0x10E)
 
#define MXS_CLOSE_DOWN   (WM_USER + 0x10F)
 
#define MXS_STOP_EDITING   (WM_USER + 0x110)
 
#define MXS_LOAD_STARTUP_SCRIPTS   (WM_USER + 0x111)
 
#define MXS_EXECUTE_MACRO   (WM_USER + 0x112)
 
#define MXS_RESTART_EDITING   (WM_USER + 0x113)
 
#define MXS_NOTIFY_REF_DEPENDENTS   (WM_USER + 0x114)
 
#define MSPLUGINCLASS_STOPEDITING   (WM_USER + 0x115)
 
#define MSPLUGINCLASS_RESTARTEDITING   (WM_USER + 0x116)
 
#define MXS_MESSAGE_BOX_EX   (WM_USER + 0x117)
 
#define MXS_MESSAGEBOX_DONT_SHOW_AGAIN   0x01000000L
 show 'Do not show this message again' check box in message box (not supported for win32 MessageBox), bit set on return if check box checked More...
 
#define MXS_MESSAGEBOX_HOLD_BUTTON   0x02000000L
 show 'Hold' button (not supported for win32 MessageBox) More...
 
#define MXS_MESSAGEBOX_WIN32_MESSAGEBOX   0x10000000L
 show message box using win32 MessageBox More...
 
#define MXS_MESSAGEBOX_MAX_MAXMSGBOX   0x20000000L
 show message box using MaxMsgBox More...
 
#define MXS_MESSAGEBOX_PARENT_HWND_SET   0x00000001L
 message_box_data_ex.parent contains parent HWND to use More...
 
#define key_arg(key)   _get_key_arg(arg_list, count, n_##key)
 
#define key_arg_or_default(key, def)   _get_key_arg_or_default(arg_list, count, n_##key##, def)
 
#define int_key_arg(key, var, def)   ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_int())
 
#define intptr_key_arg(key, var, def)   ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_intptr())
 
#define float_key_arg(key, var, def)   ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_float())
 
#define bool_key_arg(key, var, def)   ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_bool())
 
#define interval_key_arg(key, var, def)   ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_interval())
 
#define timevalue_key_arg(key, var, def)   ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_timevalue())
 
#define node_key_arg(key, var, def)   ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_node())
 
#define string_key_arg(key, var, def)   ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_string())
 
#define filename_key_arg(key, var, def)   ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_filename())
 
#define point4_key_arg(key, var, def)   ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_point4())
 
#define check_arg_count(fn, w, g)   if ((w) != (g)) throw ArgCountError (_M(#fn), w, g)
 
#define check_gen_arg_count(fn, w, g)   if ((w) != (g + 1)) throw ArgCountError (_M(#fn), w, g + 1)
 
#define check_arg_count_with_keys(fn, w, g)   if (!(g == w || (g > w && arg_list[w] == &keyarg_marker))) throw ArgCountError (_M(#fn), w, count_with_keys())
 
#define check_gen_arg_count_with_keys(fn, w, g)   if (!(g == w || (g > w && arg_list[w-1] == &keyarg_marker))) throw ArgCountError (_M(#fn), w, count_with_keys() + 1)
 
#define count_with_keys()   _count_with_keys(arg_list, count)
 
#define bool_result(val)   ((val) ? &true_value : &false_value)
 
#define MXS_range_check(_val, _lowerLimit, _upperLimit, _desc)
 
#define mputs   thread_local(current_stdout)->puts /* current MAXScript stdout output... */
 
#define mputch   thread_local(current_stdout)->putch /* current MAXScript stdout output... */
 
#define mprintf   thread_local(current_stdout)->printf
 
#define mflush   thread_local(current_stdout)->flush
 
#define INTERRUPT_EVAL   0x0001
 
#define type_check(val, cl, where)   if (val->tag != class_tag(cl)) throw TypeError (where, val, &cl##_class);
 
#define SOURCE_STREAM_ENCRYPTED_FLAG   1 /* flag set in thread local source_flags when source is encrypted */
 

Typedefs

typedef void(* utility_installer) (Rollout *ro)
 
typedef Value *(* autocad_point_reader) (MCHAR *str)
 

Functions

double EPS (float v)
 
double EPS (double v)
 
double EPS (int v)
 
double EPS (INT64 v)
 
double EPS (DWORD v)
 
double EPS (short v)
 
void out_of_memory ()
 
void bad_delete ()
 
ScripterExport Value_get_key_arg (Value **arg_list, int count, Value *key_name)
 
ScripterExport Value_get_key_arg_or_default (Value **arg_list, int count, Value *key_name, Value *def)
 
ScripterExport MCHARsave_string (const MCHAR *str)
 
MCHAR wputch (HWND w, const MCHAR *buf, const MCHAR *bufp, const MCHAR c)
 
MCHARwputs (HWND w, const MCHAR *buf, const MCHAR *bufp, const MCHAR *str)
 
int wprintf (HWND w, const MCHAR *buf, const MCHAR *bufp, const MCHAR *format,...)
 
void wflush (HWND w, const MCHAR *buf, const MCHAR *bufp)
 
ScripterExport ObjectGet_Object_Or_XRef_BaseObject (Object *obj)
 
ScripterExport int namify (MCHAR *n, int type, bool bStripTrailing=true)
 
ScripterExport void install_utility_page (Rollout *rollout)
 
ScripterExport int mxs_rand ()
 
ScripterExport INT64 mxs_rand64 ()
 
ScripterExport void mxs_seed (int)
 
ScripterExport int random_range (int from, int to)
 
ScripterExport INT64 random_range (INT64 from, INT64 to)
 
ScripterExport float random_range (float from, float to)
 
ScripterExport double random_range (double from, double to)
 
ScripterExport void dlx_detaching (HINSTANCE hinstance)
 
ScripterExport void define_system_global (const MCHAR *name, Value *(*getter)(), Value *(*setter)(Value *))
 
ScripterExport void define_system_global_replace (const MCHAR *name, Value *(*getter)(), Value *(*setter)(Value *))
 
ScripterExport void define_struct_global (const MCHAR *name, const MCHAR *struct_name, Value *(*getter)(), Value *(*setter)(Value *))
 
ScripterExport void printable_name (MSTR &name)
 
ScripterExport void show_source_pos ()
 
ScripterExport void show_listener ()
 
ScripterExport void init_MAXScript ()
 
ScripterExport void set_utility_installer (utility_installer ui)
 
ScripterExport void reset_utility_installer ()
 
ScripterExport void error_message_box (MAXScriptException &e, const MCHAR *caption)
 
ScripterExport void set_autocad_point_reader (autocad_point_reader apr)
 
ScripterExport BOOL IsMAXScriptListenerInViewport ()
 Get whether the listener is displayed in a viewport. More...
 
ScripterExport BOOL get_error_trace_back_disabled (MAXScript_TLS *_tls=nullptr)
 
ScripterExport void set_error_trace_back_disabled (BOOL isTraceBackDisabled, MAXScript_TLS *_tls=nullptr)
 
ScripterExport BOOL ExecuteMAXScriptScript (const MCHAR *s, MAXScript::ScriptSource scriptSource, BOOL quietErrors=FALSE, FPValue *fpv=NULL, BOOL logQuietErrors=TRUE)
 Function compiles and evaluates the specified string. More...
 
ScripterExport ValueExecuteScript (CharStream *source, bool *res, MAXScript::ScriptSource scriptSource)
 Function that compiles and evaluates a CharStream Maxscript expression. More...
 
ScripterExport void filein_script (const MCHAR *filename)
 Executes the given Maxscript file. More...
 
ScripterExport BOOL filein_script_ex (const MCHAR *filename, MSTR *captured_error_message, bool performEmbeddedScriptSecurityChecks=false)
 Executes the given Maxscript file. More...
 
ScripterExport void open_script_editor (const MCHAR *filename=NULL)
 Opens the specified file in the Maxscript editor. More...
 
ScripterExport DWORD ProcessDefaultActionVal (Value *inpActionVal, DWORD defaultAction=DEFAULTACTIONS_LOGMSG)
 
ScripterExport void listener_message (UINT iMsg, WPARAM wParam, LPARAM lParam, BOOL block_flag)
 
int _count_with_keys (Value **arg_list, int count)
 
ScripterExport BOOL GetPrintAllElements ()
 
ScripterExport BOOL SetPrintAllElements (BOOL)
 
ScripterExport bool GetDontRepeatMessages ()
 
ScripterExport bool SetDontRepeatMessages (bool)
 
ScripterExport bool CanChangeGroupFlags (INode *node)
 
ScripterExport BOOL Find_MXS_Name_For_Obj (Animatable *obj, MSTR &name, BOOL explicitName=TRUE)
 
ScripterExport void Replace_LF_with_CRLF (MSTR &string)
 
ScripterExport void Replace_CRLF_with_LF (MSTR &string)
 
ScripterExport void checkFileOpenModeValidity (const MCHAR *mode)
 
ScripterExport bool max_name_match (const MCHAR *max_name, const MCHAR *pattern, bool caseSensitive=false)
 
ScripterExport bool max_node_name_match (const MCHAR *max_name, const MCHAR *pattern, bool caseSensitive=false)
 
ScripterExport BitmapCreateBitmapFromBitmapInfo (BitmapInfo &bitmapInfo)
 
ScripterExport int GetStorableBitmapInfoTypeForBitmapInfoType (int type)
 
ScripterExport int ConvertValueToID (mxs_value_id_pair pairs[], int count, Value *val, int def_id=-1)
 
ScripterExport ValueConvertIDToValue (mxs_value_id_pair pairs[], int count, int id, Value *def_val=NULL)
 
ScripterExport int GetUIScaledValue (float value)
 
ScripterExport int GetValueUIUnscaled (float value)
 
ScripterExport float GetUIScaledValueFloat (float value)
 
ScripterExport float GetValueUIUnscaledFloat (float value)
 
ScripterExport Tab< const MCHAR * > GetMAXScriptParserKeywords ()
 
ScripterExport bool IsVariableNameValid (const MCHAR *var_name)
 
ScripterExport bool IsGlobalVariableNameSettable (const MCHAR *var_name)
 
ScripterExport bool SetMAXScriptListenerLogFile (const MCHAR *filename, const MCHAR *mode)
 Sets MAXScript listener log file to specified file. More...
 
ScripterExport bool GetMAXScriptListenerLogFile (MSTR &listenerLogFileName)
 Gets the MAXScript listener log file name if present. More...
 
ScripterExport bool CanRunScriptingFeature (MaxSDK::ISceneScriptSecurityManager::ScriptingFeature scriptingFeature)
 Test whether the specified ScriptingFeature can be executed. More...
 
ScripterExport void ValidateCanRunMAXScriptSystemCommand (const MCHAR *command, Value **arg_list, int count)
 Validate whether MAXScript system commands can be executed. More...
 
ScripterExport void ValidateCanRunMAXScriptSystemCommand (const MCHAR *command, const MCHAR *arguments)
 Validate whether MAXScript system commands can be executed. More...
 
ScripterExport void ValidateCanRunPythonScripts (const MCHAR *command, Value **arg_list, int count)
 Validate whether Python scripts can be executed. More...
 
ScripterExport void ValidateCanRunPythonScripts (const MCHAR *command, const MCHAR *arguments)
 Validate whether Python scripts can be executed. More...
 
ScripterExport MSTR CreateStringRepresentationOfArgumentList (Value **arg_list, int count)
 Create string representation of argument list. More...
 

Variables

static const int PROPNAME = 1
 
static const int CLASSNAME = 2
 
static const int DROPSPACES = 3
 
ScripterExport InterfaceMAXScript_interface
 
ScripterExport Interface7MAXScript_interface7
 
ScripterExport Interface8MAXScript_interface8
 
ScripterExport Interface9MAXScript_interface9
 
ScripterExport Interface11MAXScript_interface11
 
ScripterExport Interface13MAXScript_interface13
 
ScripterExport Interface14MAXScript_interface14
 
ScripterExport Interface17MAXScript_interface17
 
MAX_DEPRECATED ScripterExport Interface17MAXScript_interface18
 
MAX_DEPRECATED ScripterExport Interface17MAXScript_interface19
 
ScripterExport BOOL escape_enabled
 
ScripterExport BOOL MAXScript_detaching
 
ScripterExport BOOL MAXScript_running
 
ScripterExport HWND main_thread_window
 
ScripterExport BOOL progress_bar_up
 
ScripterExport IMXSDebuggertheMXSDebugger
 The MXS debugger interface. A Singleton. More...
 
ScripterExport HashTableglobals
 
ScripterExport HashTablepersistents
 
ScripterExport Listenerthe_listener
 
ScripterExport HWND the_listener_window
 
ScripterExport RandGeneratorClassIDRandGenerator
 

Macro Definition Documentation

◆ WIN32_LEAN_AND_MEAN

#define WIN32_LEAN_AND_MEAN

◆ NOT_SUPPORTED_BY_PRODUCT

#define NOT_SUPPORTED_BY_PRODUCT (   fn)     throw RuntimeError (_M("Feature not available: "), _M(#fn));

◆ END

#define END   NULL

◆ MAXSCRIPT_UTILITY_CLASS_ID

#define MAXSCRIPT_UTILITY_CLASS_ID   Class_ID(0x4d64858, 0x16d1751d)

◆ MAX_SCRIPT_DIR

#define MAX_SCRIPT_DIR   _M("scripts")

◆ SCRIPT_AUTOLOAD_DIR

#define SCRIPT_AUTOLOAD_DIR   _M("Startup\\")

◆ no_mb_chars

#define no_mb_chars   (MB_CUR_MAX == 1)

◆ bytelen

#define bytelen (   s)    strlen(s)

◆ MXS_ADD_ROLLOUT_PAGE

#define MXS_ADD_ROLLOUT_PAGE   (WM_USER + 0x100)

◆ MXS_DELETE_ROLLOUT_PAGE

#define MXS_DELETE_ROLLOUT_PAGE   (WM_USER + 0x101)

◆ MXS_REDRAW_VIEWS

#define MXS_REDRAW_VIEWS   (WM_USER + 0x102)

◆ MXS_EDIT_SCRIPT

#define MXS_EDIT_SCRIPT   (WM_USER + 0x103)

◆ MXS_NEW_SCRIPT

#define MXS_NEW_SCRIPT   (WM_USER + 0x104)

◆ MXS_DISPLAY_BITMAP

#define MXS_DISPLAY_BITMAP   (WM_USER + 0x105)

◆ MXS_ERROR_MESSAGE_BOX

#define MXS_ERROR_MESSAGE_BOX   (WM_USER + 0x106)

◆ MXS_PRINT_STRING

#define MXS_PRINT_STRING   (WM_USER + 0x107)

◆ MXS_LISTENER_EVAL

#define MXS_LISTENER_EVAL   (WM_USER + 0x108)

◆ MXS_MESSAGE_BOX

#define MXS_MESSAGE_BOX   (WM_USER + 0x109)

◆ MXS_INITIALIZE_MAXSCRIPT

#define MXS_INITIALIZE_MAXSCRIPT   (WM_USER + 0x10A)

◆ MXS_KEYBOARD_INPUT

#define MXS_KEYBOARD_INPUT   (WM_USER + 0x10B)

◆ MXS_SHOW_SOURCE

#define MXS_SHOW_SOURCE   (WM_USER + 0x10C)

◆ MXS_TAKE_FOCUS

#define MXS_TAKE_FOCUS   (WM_USER + 0x10D)

◆ MXS_STOP_CREATING

#define MXS_STOP_CREATING   (WM_USER + 0x10E)

◆ MXS_CLOSE_DOWN

#define MXS_CLOSE_DOWN   (WM_USER + 0x10F)

◆ MXS_STOP_EDITING

#define MXS_STOP_EDITING   (WM_USER + 0x110)

◆ MXS_LOAD_STARTUP_SCRIPTS

#define MXS_LOAD_STARTUP_SCRIPTS   (WM_USER + 0x111)

◆ MXS_EXECUTE_MACRO

#define MXS_EXECUTE_MACRO   (WM_USER + 0x112)

◆ MXS_RESTART_EDITING

#define MXS_RESTART_EDITING   (WM_USER + 0x113)

◆ MXS_NOTIFY_REF_DEPENDENTS

#define MXS_NOTIFY_REF_DEPENDENTS   (WM_USER + 0x114)

◆ MSPLUGINCLASS_STOPEDITING

#define MSPLUGINCLASS_STOPEDITING   (WM_USER + 0x115)

◆ MSPLUGINCLASS_RESTARTEDITING

#define MSPLUGINCLASS_RESTARTEDITING   (WM_USER + 0x116)

◆ MXS_MESSAGE_BOX_EX

#define MXS_MESSAGE_BOX_EX   (WM_USER + 0x117)

◆ MXS_MESSAGEBOX_DONT_SHOW_AGAIN

#define MXS_MESSAGEBOX_DONT_SHOW_AGAIN   0x01000000L

show 'Do not show this message again' check box in message box (not supported for win32 MessageBox), bit set on return if check box checked

◆ MXS_MESSAGEBOX_HOLD_BUTTON

#define MXS_MESSAGEBOX_HOLD_BUTTON   0x02000000L

show 'Hold' button (not supported for win32 MessageBox)

◆ MXS_MESSAGEBOX_WIN32_MESSAGEBOX

#define MXS_MESSAGEBOX_WIN32_MESSAGEBOX   0x10000000L

show message box using win32 MessageBox

◆ MXS_MESSAGEBOX_MAX_MAXMSGBOX

#define MXS_MESSAGEBOX_MAX_MAXMSGBOX   0x20000000L

show message box using MaxMsgBox

◆ MXS_MESSAGEBOX_PARENT_HWND_SET

#define MXS_MESSAGEBOX_PARENT_HWND_SET   0x00000001L

message_box_data_ex.parent contains parent HWND to use

◆ key_arg

#define key_arg (   key)    _get_key_arg(arg_list, count, n_##key)

◆ key_arg_or_default

#define key_arg_or_default (   key,
  def 
)    _get_key_arg_or_default(arg_list, count, n_##key##, def)

◆ int_key_arg

#define int_key_arg (   key,
  var,
  def 
)    ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_int())

◆ intptr_key_arg

#define intptr_key_arg (   key,
  var,
  def 
)    ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_intptr())

◆ float_key_arg

#define float_key_arg (   key,
  var,
  def 
)    ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_float())

◆ bool_key_arg

#define bool_key_arg (   key,
  var,
  def 
)    ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_bool())

◆ interval_key_arg

#define interval_key_arg (   key,
  var,
  def 
)    ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_interval())

◆ timevalue_key_arg

#define timevalue_key_arg (   key,
  var,
  def 
)    ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_timevalue())

◆ node_key_arg

#define node_key_arg (   key,
  var,
  def 
)    ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_node())

◆ string_key_arg

#define string_key_arg (   key,
  var,
  def 
)    ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_string())

◆ filename_key_arg

#define filename_key_arg (   key,
  var,
  def 
)    ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_filename())

◆ point4_key_arg

#define point4_key_arg (   key,
  var,
  def 
)    ((var = _get_key_arg(arg_list, count, n_##key)) == &unsupplied ? def : var->to_point4())

◆ check_arg_count

#define check_arg_count (   fn,
  w,
 
)    if ((w) != (g)) throw ArgCountError (_M(#fn), w, g)

◆ check_gen_arg_count

#define check_gen_arg_count (   fn,
  w,
 
)    if ((w) != (g + 1)) throw ArgCountError (_M(#fn), w, g + 1)

◆ check_arg_count_with_keys

#define check_arg_count_with_keys (   fn,
  w,
 
)    if (!(g == w || (g > w && arg_list[w] == &keyarg_marker))) throw ArgCountError (_M(#fn), w, count_with_keys())

◆ check_gen_arg_count_with_keys

#define check_gen_arg_count_with_keys (   fn,
  w,
 
)    if (!(g == w || (g > w && arg_list[w-1] == &keyarg_marker))) throw ArgCountError (_M(#fn), w, count_with_keys() + 1)

◆ count_with_keys

#define count_with_keys ( )    _count_with_keys(arg_list, count)

◆ bool_result

#define bool_result (   val)    ((val) ? &true_value : &false_value)

◆ MXS_range_check

#define MXS_range_check (   _val,
  _lowerLimit,
  _upperLimit,
  _desc 
)
Value:
if (_val < _lowerLimit || _val > _upperLimit) { \
MCHAR buf[256]; \
MCHAR buf2[128]; \
_tcscpy(buf,_desc); \
_tcscat(buf,_M(" < ")); \
_sntprintf(buf2, 128, _M("%g"), EPS(_lowerLimit)); \
_tcscat(buf,buf2); \
_tcscat(buf,_M(" or > ")); \
_sntprintf(buf2, 128, _M("%g"), EPS(_upperLimit)); \
_tcscat(buf,buf2); \
_tcscat(buf,_M(": ")); \
_sntprintf(buf2, 128, _M("%g"), EPS(_val)); \
_tcscat(buf,buf2); \
throw RuntimeError (buf); \
}
Definition: exceptions.h:289
double EPS(float v)
Definition: maxscript.h:84
#define _M(x)
Used to wrap string literals.
Definition: strbasic.h:67

◆ mputs

#define mputs   thread_local(current_stdout)->puts /* current MAXScript stdout output... */

◆ mputch

#define mputch   thread_local(current_stdout)->putch /* current MAXScript stdout output... */

◆ mprintf

#define mprintf   thread_local(current_stdout)->printf

◆ mflush

#define mflush   thread_local(current_stdout)->flush

◆ INTERRUPT_EVAL

#define INTERRUPT_EVAL   0x0001

◆ type_check

#define type_check (   val,
  cl,
  where 
)    if (val->tag != class_tag(cl)) throw TypeError (where, val, &cl##_class);

◆ SOURCE_STREAM_ENCRYPTED_FLAG

#define SOURCE_STREAM_ENCRYPTED_FLAG   1 /* flag set in thread local source_flags when source is encrypted */

Typedef Documentation

◆ utility_installer

typedef void(* utility_installer) (Rollout *ro)

◆ autocad_point_reader

typedef Value*(* autocad_point_reader) (MCHAR *str)

Function Documentation

◆ EPS() [1/6]

double EPS ( float  v)
inline
84 { return (std::isnan)(v) ? (v) : fabs(v) < FLT_EPSILON ? 0.0 : (v); } // small number round down for %g float printing

◆ EPS() [2/6]

double EPS ( double  v)
inline
85 { return (std::isnan)(v) ? (v) : fabs(v) < DBL_EPSILON ? 0.0 : (v); } // small number round down for %g double printing

◆ EPS() [3/6]

double EPS ( int  v)
inline
86 { return (double)v; }

◆ EPS() [4/6]

double EPS ( INT64  v)
inline
87 { return (double)v; }

◆ EPS() [5/6]

double EPS ( DWORD  v)
inline
88 { return (double)v; }

◆ EPS() [6/6]

double EPS ( short  v)
inline
89 { return (double)v; }

◆ out_of_memory()

void out_of_memory ( )

◆ bad_delete()

void bad_delete ( )

◆ _get_key_arg()

ScripterExport Value* _get_key_arg ( Value **  arg_list,
int  count,
Value key_name 
)

◆ _get_key_arg_or_default()

ScripterExport Value* _get_key_arg_or_default ( Value **  arg_list,
int  count,
Value key_name,
Value def 
)

◆ save_string()

ScripterExport MCHAR* save_string ( const MCHAR str)

◆ wputch()

MCHAR wputch ( HWND  w,
const MCHAR buf,
const MCHAR bufp,
const MCHAR  c 
)

◆ wputs()

MCHAR* wputs ( HWND  w,
const MCHAR buf,
const MCHAR bufp,
const MCHAR str 
)

◆ wprintf()

int wprintf ( HWND  w,
const MCHAR buf,
const MCHAR bufp,
const MCHAR format,
  ... 
)

◆ wflush()

void wflush ( HWND  w,
const MCHAR buf,
const MCHAR bufp 
)

◆ Get_Object_Or_XRef_BaseObject()

ScripterExport Object* Get_Object_Or_XRef_BaseObject ( Object obj)

◆ namify()

ScripterExport int namify ( MCHAR n,
int  type,
bool  bStripTrailing = true 
)

◆ install_utility_page()

ScripterExport void install_utility_page ( Rollout rollout)

◆ mxs_rand()

ScripterExport int mxs_rand ( )

◆ mxs_rand64()

ScripterExport INT64 mxs_rand64 ( )

◆ mxs_seed()

ScripterExport void mxs_seed ( int  )

◆ random_range() [1/4]

ScripterExport int random_range ( int  from,
int  to 
)

◆ random_range() [2/4]

ScripterExport INT64 random_range ( INT64  from,
INT64  to 
)

◆ random_range() [3/4]

ScripterExport float random_range ( float  from,
float  to 
)

◆ random_range() [4/4]

ScripterExport double random_range ( double  from,
double  to 
)

◆ dlx_detaching()

ScripterExport void dlx_detaching ( HINSTANCE  hinstance)

◆ define_system_global()

ScripterExport void define_system_global ( const MCHAR name,
Value *(*)()  getter,
Value *(*)(Value *)  setter 
)

◆ define_system_global_replace()

ScripterExport void define_system_global_replace ( const MCHAR name,
Value *(*)()  getter,
Value *(*)(Value *)  setter 
)

◆ define_struct_global()

ScripterExport void define_struct_global ( const MCHAR name,
const MCHAR struct_name,
Value *(*)()  getter,
Value *(*)(Value *)  setter 
)

◆ printable_name()

ScripterExport void printable_name ( MSTR name)

◆ show_source_pos()

ScripterExport void show_source_pos ( )

◆ show_listener()

ScripterExport void show_listener ( )

◆ init_MAXScript()

ScripterExport void init_MAXScript ( )

◆ set_utility_installer()

ScripterExport void set_utility_installer ( utility_installer  ui)

◆ reset_utility_installer()

ScripterExport void reset_utility_installer ( )

◆ error_message_box()

ScripterExport void error_message_box ( MAXScriptException e,
const MCHAR caption 
)

◆ set_autocad_point_reader()

ScripterExport void set_autocad_point_reader ( autocad_point_reader  apr)

◆ IsMAXScriptListenerInViewport()

ScripterExport BOOL IsMAXScriptListenerInViewport ( )

Get whether the listener is displayed in a viewport.

Returns true if listener displayed in viewport

◆ get_error_trace_back_disabled()

ScripterExport BOOL get_error_trace_back_disabled ( MAXScript_TLS _tls = nullptr)

◆ set_error_trace_back_disabled()

ScripterExport void set_error_trace_back_disabled ( BOOL  isTraceBackDisabled,
MAXScript_TLS _tls = nullptr 
)

◆ ExecuteMAXScriptScript()

ScripterExport BOOL ExecuteMAXScriptScript ( const MCHAR s,
MAXScript::ScriptSource  scriptSource,
BOOL  quietErrors = FALSE,
FPValue fpv = NULL,
BOOL  logQuietErrors = TRUE 
)

Function compiles and evaluates the specified string.

If the string is successfully compiled and evaluated, and a pointer to an FPValue is provided, the return value is converted to an FPValue and returned through the referenced FPValue. If the string is not successfully compiled and evaluated: Error messages are by default logged to LogSys if net rendering. If not net rendering, error messages are written to Listener or by default logged to LogSys if in quiet mode. If a pointer to an FPValue is provided, the error message is stored in the FPValue as a TYPE_TSTR. Note: This must be called from the main max thread (That contains UI Controls). This is due to the possibility that results from the Maxscript actions can cause the UI to be updated. And since Much of the UI contains WPF Elements which will throw an exception if NOT updated from the main thread.

Parameters
s- Points to a null-terminated string that specifies the MAXScript commands to compile and evaluate. This expects a string containing Maxscript expressions, NOT a file path.
scriptSource- the source of the script string.
quietErrors- If TRUE, or net rendering, errors are by default logged to LogSys. If FALSE and not net rendering, errors are logged to Listener.
fpv- Optionally points to an FPValue. If not NULL, the result of the script evaluation is converted to an FPValue and stored in the specified FPValue. If an error occurs, the error message is stored in the FPValue as a TYPE_TSTR.
logQuietErrors- If TRUE and quietErrors is TRUE, errors are logged to LogSys. If FALSE and quietErrors is TRUE, errors are not logged to LogSys.
Returns
Returns TRUE if script was executed successfully.
Note
As of 3ds Max 2016, if the result of the script evaluation cannot be converted to an FPValue, the FPValue is set to TYPE_VALUE and the Value* is stored in it. The Value* is guaranteed to be protected from garbage collection only until a new Value* is created or a new expression is evaluated in the calling thread. So the calling code must protect the Value* from garbage collection as soon as possible. Typically this is done via value local storage (for example, one_value_local), a ValueHolder, or a ValueHolderMember. For example:
FPValue result;
if (!ExecuteMAXScriptScript(fileReader.ReadFull().ToMCHAR(), false, &result))
return;
if (result.type != TYPE_VALUE)
return;
ValueHolderMember res(result.v);
Definition: ifnpub.h:1191
Value * v
Definition: ifnpub.h:1237
ParamType2 type
Definition: ifnpub.h:1193
Definition: ValueHolderMember.h:47
ScripterExport BOOL ExecuteMAXScriptScript(const MCHAR *s, MAXScript::ScriptSource scriptSource, BOOL quietErrors=FALSE, FPValue *fpv=NULL, BOOL logQuietErrors=TRUE)
Function compiles and evaluates the specified string.
@ TYPE_VALUE
Identifies a MAXSCript value argument type or return value.
Definition: paramtype.h:131

◆ ExecuteScript()

ScripterExport Value* ExecuteScript ( CharStream source,
bool *  res,
MAXScript::ScriptSource  scriptSource 
)

Function that compiles and evaluates a CharStream Maxscript expression.

Parameters
source- Contains the script to compile and evaluate.
[in,out]res- If res is non-NULL, will contain TRUE on return if script was executed successfully, FALSE if not.
scriptSource- the source of the script string.
Returns
Returns Value* resulting from evaluating source. Evaluation is within a try/catch, so this function will not throw.

◆ filein_script()

ScripterExport void filein_script ( const MCHAR filename)

Executes the given Maxscript file.

Internally this calls filein_script_ex.

Parameters
filename- If filename is NULL, this will open a dialog prompting the user to choose a file path to an existing script. If the parameter is non-null, then the given file will be evaluated and compiled.

◆ filein_script_ex()

ScripterExport BOOL filein_script_ex ( const MCHAR filename,
MSTR captured_error_message,
bool  performEmbeddedScriptSecurityChecks = false 
)

Executes the given Maxscript file.

Parameters
[in]filename- The fully qualified path to the existing file. This can be either maxscript files (*.ms), or maxscript zip files (*.mzp), or encrypted maxscript files (*.mse).
[out]captured_error_message- String for capturing error message.
[in]performEmbeddedScriptSecurityChecks- If true, if thread's scriptSource is Embedded and Safe Scene Script Execution Mode is enabled validate script file extension is valid to run and run script as embedded.
Returns
- TRUE if the script was successfully evaluated and compiled, FALSE otherwise.
Note
- if captured_error_message is specified and an error occurs, no error dialog is displayed. If captured_error_message is not specified and an error occurs, whether a error dialog is displayed depends on current quiet mode state.

◆ open_script_editor()

ScripterExport void open_script_editor ( const MCHAR filename = NULL)

Opens the specified file in the Maxscript editor.

Parameters
filename- If filename is NULL, this will open a dialog prompting the user to choose a file path to an existing script. If the filename is not found, and empty script is opened in the script editor with the specified filename. If the parameter is non-null, then the given file will be opened in the Maxscript editor.

◆ ProcessDefaultActionVal()

ScripterExport DWORD ProcessDefaultActionVal ( Value inpActionVal,
DWORD  defaultAction = DEFAULTACTIONS_LOGMSG 
)

◆ listener_message()

ScripterExport void listener_message ( UINT  iMsg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  block_flag 
)

◆ _count_with_keys()

int _count_with_keys ( Value **  arg_list,
int  count 
)
inline
417 {
418  // compute # args before any key-args
419  for (int i = 0; i < count; i++)
420  if (arg_list[i] == (Value*)&keyarg_marker)
421  return i;
422  return count;
423 }
Definition: value.h:107

◆ GetPrintAllElements()

ScripterExport BOOL GetPrintAllElements ( )

◆ SetPrintAllElements()

ScripterExport BOOL SetPrintAllElements ( BOOL  )

◆ GetDontRepeatMessages()

ScripterExport bool GetDontRepeatMessages ( )

◆ SetDontRepeatMessages()

ScripterExport bool SetDontRepeatMessages ( bool  )

◆ CanChangeGroupFlags()

ScripterExport bool CanChangeGroupFlags ( INode node)

◆ Find_MXS_Name_For_Obj()

ScripterExport BOOL Find_MXS_Name_For_Obj ( Animatable obj,
MSTR name,
BOOL  explicitName = TRUE 
)

◆ Replace_LF_with_CRLF()

ScripterExport void Replace_LF_with_CRLF ( MSTR string)

◆ Replace_CRLF_with_LF()

ScripterExport void Replace_CRLF_with_LF ( MSTR string)

◆ checkFileOpenModeValidity()

ScripterExport void checkFileOpenModeValidity ( const MCHAR mode)

◆ max_name_match()

ScripterExport bool max_name_match ( const MCHAR max_name,
const MCHAR pattern,
bool  caseSensitive = false 
)

◆ max_node_name_match()

ScripterExport bool max_node_name_match ( const MCHAR max_name,
const MCHAR pattern,
bool  caseSensitive = false 
)

◆ CreateBitmapFromBitmapInfo()

ScripterExport Bitmap* CreateBitmapFromBitmapInfo ( BitmapInfo bitmapInfo)

◆ GetStorableBitmapInfoTypeForBitmapInfoType()

ScripterExport int GetStorableBitmapInfoTypeForBitmapInfoType ( int  type)

◆ ConvertValueToID()

ScripterExport int ConvertValueToID ( mxs_value_id_pair  pairs[],
int  count,
Value val,
int  def_id = -1 
)

◆ ConvertIDToValue()

ScripterExport Value* ConvertIDToValue ( mxs_value_id_pair  pairs[],
int  count,
int  id,
Value def_val = NULL 
)

◆ GetMAXScriptParserKeywords()

ScripterExport Tab<const MCHAR*> GetMAXScriptParserKeywords ( )

◆ IsVariableNameValid()

ScripterExport bool IsVariableNameValid ( const MCHAR var_name)

◆ IsGlobalVariableNameSettable()

ScripterExport bool IsGlobalVariableNameSettable ( const MCHAR var_name)

Variable Documentation

◆ PROPNAME

const int PROPNAME = 1
static

◆ CLASSNAME

const int CLASSNAME = 2
static

◆ DROPSPACES

const int DROPSPACES = 3
static

◆ MAXScript_interface

ScripterExport Interface* MAXScript_interface
extern

◆ MAXScript_interface7

ScripterExport Interface7* MAXScript_interface7
extern

◆ MAXScript_interface8

ScripterExport Interface8* MAXScript_interface8
extern

◆ MAXScript_interface9

ScripterExport Interface9* MAXScript_interface9
extern

◆ MAXScript_interface11

ScripterExport Interface11* MAXScript_interface11
extern

◆ MAXScript_interface13

ScripterExport Interface13* MAXScript_interface13
extern

◆ MAXScript_interface14

ScripterExport Interface14* MAXScript_interface14
extern

◆ MAXScript_interface17

ScripterExport Interface17* MAXScript_interface17
extern

◆ MAXScript_interface18

MAX_DEPRECATED ScripterExport Interface17* MAXScript_interface18
extern
Deprecated:
This has been deprecated as of 3ds Max 2022, with Interface18 specific methods moved to Interface13

◆ MAXScript_interface19

MAX_DEPRECATED ScripterExport Interface17* MAXScript_interface19
extern
Deprecated:
This has been deprecated as of 3ds Max 2022, with Interface19 specific methods moved to Interface14

◆ escape_enabled

ScripterExport BOOL escape_enabled
extern

◆ MAXScript_detaching

ScripterExport BOOL MAXScript_detaching
extern

◆ MAXScript_running

ScripterExport BOOL MAXScript_running
extern

◆ main_thread_window

ScripterExport HWND main_thread_window
extern

◆ progress_bar_up

ScripterExport BOOL progress_bar_up
extern

◆ theMXSDebugger

ScripterExport IMXSDebugger* theMXSDebugger
extern

The MXS debugger interface. A Singleton.

◆ globals

ScripterExport HashTable* globals
extern

◆ persistents

ScripterExport HashTable* persistents
extern

◆ the_listener

ScripterExport Listener* the_listener
extern

◆ the_listener_window

ScripterExport HWND the_listener_window
extern

◆ ClassIDRandGenerator

ScripterExport RandGenerator* ClassIDRandGenerator
extern