Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #pragma once
00033
00034 #include "iFnPub.h"
00035 #include "actiontableTypedefs.h"
00036 #include "maxscript/ScripterExport.h"
00037
00038 class Value;
00039 class Parser;
00040
00041 typedef short MacroID;
00042
00043
00062 class MacroEntry : public BaseInterfaceServer
00063 {
00064 public:
00065
00067 virtual MacroID GetID() = 0;
00069 virtual MSTR& GetName() = 0;
00071 virtual MSTR& GetCategory() = 0;
00075 virtual MSTR& GetInternalCategory() = 0;
00077 virtual MSTR& GetFileName() = 0;
00079
00082 virtual long GetOffset() = 0;
00084
00095 virtual Value* GetCode() = 0;
00097 virtual MSTR& GetToolTip() = 0;
00099 virtual MSTR& GetButtonText() = 0;
00101 virtual MSTR& GetButtonIconFile() = 0;
00103 virtual int GetButtonIconIndex() = 0;
00105
00117 virtual short GetFlags(short mask) = 0;
00118
00119
00121
00128 virtual Value* Execute() = 0;
00129
00130
00132
00145 virtual Value* CallHandler(Value* handler_or_name, Value** arg_list, int count, BOOL hold = TRUE)=0;
00147
00156 virtual FPStatus CallHandler(const MCHAR* handler_name, FPParams* params, FPValue& result, BOOL hold = TRUE)=0;
00157
00159 virtual Value* GetHandler(Value* handler_name)=0;
00160
00162 virtual BOOL HasHandler(const MCHAR* handler_name)=0;
00163
00165
00170 virtual BOOL Compile(Parser* parser = NULL) = 0;
00171
00173 virtual void MarkAsUsed() = 0;
00174
00176
00182 ScripterExport static void DisableCompiles();
00183
00185
00191 ScripterExport static void EnableCompiles();
00192
00194
00200 ScripterExport static void CompileUsed();
00201
00203 virtual void Reset() = 0;
00204
00205
00206 virtual void DeleteThis() = 0;
00207
00209 virtual MaxIcon* GetIcon()=0;
00210 };
00211
00212 #define ME_DROPPED_SCRIPT 0x0001 // macro made from some drag-and-dropped text
00213 #define ME_SILENT_ERRORS 0x0002 // macro won't report any runtime errors
00214 #define ME_HAS_EXECUTE 0x0004 // has execute handler
00215 #define ME_TEMPORARY 0x0008 // temporary dropScript
00216 #define ME_NO_AUTO_UNDO 0x0010 // execution of the macroscript is not automatically wrapped in a thehold begin/accept
00217 #define ME_NEEDS_COMPILE 0x0020 // macro should be compiled when maxscript starts up
00218
00219 #define BAD_MACRO_ID -1 // illegal macroID
00220
00251 class MacroDir : public InterfaceServer
00252 {
00253 public:
00254
00255
00261 virtual MacroEntry* GetMacro(MacroID mid) = 0;
00269 virtual MacroEntry* FindMacro(const MCHAR* category, const MCHAR* name) = 0;
00275 virtual BOOL ValidID(MacroID mid) = 0;
00276
00277
00280 virtual int Count() = 0;
00287 virtual MacroEntry* GetMacro(int index) = 0;
00288
00289
00290
00291
00292
00311 virtual MacroEntry* AddMacro(const MCHAR* category, const MCHAR* internalCategory, const MCHAR* name,
00312 const MCHAR* tooltip, const MCHAR* buttonText,
00313 const MCHAR* sourceFile, int sourceOffset) = 0;
00335 virtual MacroEntry* AddMacro(const MCHAR* category, const MCHAR* internalCategory, const MCHAR* name,
00336 const MCHAR* tooltip, const MCHAR* buttonText,
00337 const MCHAR* sourceText) = 0;
00338
00352 virtual BOOL SetMacro(MacroID mid, const MCHAR* tooltip, const MCHAR* btnText, const MCHAR* sourceFile, int sourceOffset) = 0;
00358 virtual MCHAR* MakeNameValid(MCHAR* s) = 0;
00364 virtual MCHAR* MakeCategoryValid(MCHAR* s) = 0;
00365
00366
00372 virtual BOOL EditMacro(MacroID mid) = 0;
00373
00374
00384 virtual Value* Execute(MacroID mid) = 0;
00385
00386 virtual Value* CallHandler(MacroID mid, Value* handler_or_name, Value** arg_list, int count, BOOL hold = TRUE)=0;
00387 virtual FPStatus CallHandler(MacroID mid, const MCHAR* handler_name, FPParams* params, FPValue& result, BOOL hold = TRUE)=0;
00388 virtual Value* GetHandler(MacroID mid, Value* handler_name)=0;
00389
00390
00401 virtual void LoadMacroScripts(const MCHAR* path_name = NULL, BOOL recurse = TRUE) = 0;
00402 virtual MacroEntry* LoadMacroScript(const MCHAR* file_name) = 0;
00403
00404
00410 virtual void SetMacroScriptPath(const MCHAR* path_name) = 0;
00413 virtual const MCHAR* GetMacroScriptPath() = 0;
00414 };
00415
00416 #if defined(BLD_CORE)
00417
00420 extern MacroDir& GetMacroScriptDir();
00421 #else
00422
00425 extern ScripterExport MacroDir& GetMacroScriptDir();
00430 extern ScripterExport void InitMacroScriptDir();
00431 #endif
00432
00433
00434 const ActionTableId kActionMacroScripts = 647394;
00435 const ActionContextId kActionMacroScriptsContext = 647394;
00436