00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef __ASASSETPROCESSOR_H__
00017 #define __ASASSETPROCESSOR_H__
00018
00019
00020 #include "../../dependencies.h"
00021
00022 #ifdef __COMPILE_WITH_ANGELSCRIPT__
00023
00024 #include "../../core/AssetProcessor.h"
00025 #include "../ScriptHelper.h"
00026
00027
00029 extern void bindAssetProcessor(asIScriptEngine *engine);
00030
00033 template<typename T>
00034 void bindAssetProcessorBase(asIScriptEngine *engine, const char *type)
00035 {
00036
00037 int r;
00038 std::string sType = type;
00039
00040
00041 r = engine->RegisterObjectBehaviour(type, asBEHAVE_ADDREF, "void f()",
00042 asMETHOD(T, grab), asCALL_THISCALL); assert(r >= 0);
00043 r = engine->RegisterObjectBehaviour(type, asBEHAVE_RELEASE, "void f()",
00044 asMETHOD(T, drop), asCALL_THISCALL); assert(r >= 0);
00045
00046 r = engine->RegisterObjectBehaviour("AssetProcessor", asBEHAVE_REF_CAST, std::string(sType + "@ f()").c_str(),
00047 asFUNCTION((asRefCast<AssetProcessor,T>)), asCALL_CDECL_OBJLAST); assert( r >= 0 );
00048 r = engine->RegisterObjectBehaviour(type, asBEHAVE_IMPLICIT_REF_CAST, std::string("AssetProcessor@ f()").c_str(),
00049 asFUNCTION((asRefCast<T,AssetProcessor>)), asCALL_CDECL_OBJLAST); assert( r >= 0 );
00050
00051
00052 r = engine->RegisterObjectMethod(type, "const string& getBaseName()",
00053 asMETHOD(T, getBaseName), asCALL_THISCALL); assert(r >= 0);
00054 r = engine->RegisterObjectMethod(type, "AssetGroup@ getParent()",
00055 asMETHOD(T, getParent), asCALL_THISCALL); assert(r >= 0);
00056
00057 r = engine->RegisterObjectMethod(type, "bool reloadAsset(const string &in)",
00058 asMETHOD(T, reloadAsset), asCALL_THISCALL); assert(r >= 0);
00059 r = engine->RegisterObjectMethod(type, "void reloadAssets()",
00060 asMETHOD(T, reloadAssets), asCALL_THISCALL); assert(r >= 0);
00061
00062 r = engine->RegisterObjectMethod(type, "bool removeAsset(const string &in)",
00063 asMETHOD(T, removeAsset), asCALL_THISCALL); assert(r >= 0);
00064 r = engine->RegisterObjectMethod(type, "void removeAssets()",
00065 asMETHOD(T, removeAssets), asCALL_THISCALL); assert(r >= 0);
00066 }
00067
00068 #endif // __COMPILE_WITH_ANGELSCRIPT__
00069
00070 #endif