| 1 |
#pragma once |
| 2 |
|
| 3 |
#include "iscript.h" |
| 4 |
#include "iscriptinterface.h" |
| 5 |
|
| 6 |
#include "modelskin.h" |
| 7 |
|
| 8 |
namespace script |
| 9 |
{ |
| 10 |
|
| 11 |
// Wrapper class to represent a ModelSkin object in Python |
| 12 |
class ScriptModelSkin |
| 13 |
{ |
| 14 |
decl::ISkin::Ptr _skin; |
| 15 |
public: |
| 16 |
ScriptModelSkin(const decl::ISkin::Ptr& skin) : |
| 17 |
_skin(skin) |
| 18 |
{} |
| 19 |
|
| 20 |
std::string getName() |
| 21 |
{ |
| 22 |
return _skin ? _skin->getDeclName() : std::string(); |
| 23 |
} |
| 24 |
|
| 25 |
std::string getRemap(const std::string& name) |
| 26 |
{ |
| 27 |
return _skin ? _skin->getRemap(name) : std::string(); |
| 28 |
} |
| 29 |
}; |
| 30 |
|
| 31 |
/** |
| 32 |
* greebo: This class registers the GlobalSkinCache interface with the |
| 33 |
* scripting system. |
| 34 |
*/ |
| 35 |
class ModelSkinCacheInterface : |
| 36 |
public IScriptInterface |
| 37 |
{ |
| 38 |
public: |
| 39 |
// Mapped methods |
| 40 |
ScriptModelSkin capture(const std::string& name); |
| 41 |
StringList getSkinsForModel(const std::string& model); |
| 42 |
StringList getAllSkins(); |
| 43 |
void refresh(); |
| 44 |
|
| 45 |
// IScriptInterface implementation |
| 46 |
void registerInterface(py::module& scope, py::dict& globals) override; |
| 47 |
}; |
| 48 |
|
| 49 |
} // namespace script |