diff --git a/Content/Documentation/ScriptingAPI-Documentation.md b/Content/Documentation/ScriptingAPI-Documentation.md index 753b73f583..9df15f1479 100644 --- a/Content/Documentation/ScriptingAPI-Documentation.md +++ b/Content/Documentation/ScriptingAPI-Documentation.md @@ -437,6 +437,7 @@ Gives you the ability to render text with a custom font. A texture image data. - [constructor]Texture(opt string filename) -- creates a texture from file - [outer]texturehelper -- a global helper texture creation utility +- IsValid() : bool -- whether the texture contains valid data, if it has been created successfully - GetWidth() : int - GetHeight() : int - GetDepth() : int diff --git a/WickedEngine/wiTexture_BindLua.cpp b/WickedEngine/wiTexture_BindLua.cpp index 19416b1007..260059bde6 100644 --- a/WickedEngine/wiTexture_BindLua.cpp +++ b/WickedEngine/wiTexture_BindLua.cpp @@ -14,6 +14,7 @@ namespace wi::lua lunamethod(Texture_BindLua, CreateLensDistortionNormalMap), lunamethod(Texture_BindLua, Save), + lunamethod(Texture_BindLua, IsValid), lunamethod(Texture_BindLua, GetWidth), lunamethod(Texture_BindLua, GetHeight), lunamethod(Texture_BindLua, GetDepth), @@ -203,6 +204,11 @@ namespace wi::lua return 0; } + int Texture_BindLua::IsValid(lua_State* L) + { + wi::lua::SSetBool(L, resource.IsValid() && resource.GetTexture().IsValid()); + return 1; + } int Texture_BindLua::GetWidth(lua_State* L) { if (!resource.IsValid() || !resource.GetTexture().IsValid()) diff --git a/WickedEngine/wiTexture_BindLua.h b/WickedEngine/wiTexture_BindLua.h index 2c5b5fb050..224aa27464 100644 --- a/WickedEngine/wiTexture_BindLua.h +++ b/WickedEngine/wiTexture_BindLua.h @@ -26,6 +26,7 @@ namespace wi::lua int CreateLensDistortionNormalMap(lua_State* L); int Save(lua_State* L); + int IsValid(lua_State* L); int GetWidth(lua_State* L); int GetHeight(lua_State* L); int GetDepth(lua_State* L); diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index d3dc18110e..ad9de375bd 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wi::version // minor features, major updates, breaking compatibility changes const int minor = 71; // minor bug fixes, alterations, refactors, updates - const int revision = 562; + const int revision = 563; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);