Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#6023: Start exposing the DeclarationManager interface to Python scripts
- Loading branch information
1 parent
eae2a8e
commit c58edd6
Showing
6 changed files
with
77 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "DeclarationManagerInterface.h" | ||
|
||
namespace script | ||
{ | ||
|
||
ScriptDeclaration DeclarationManagerInterface::findDeclaration(decl::Type type, const std::string& name) | ||
{ | ||
return ScriptDeclaration({}); | ||
} | ||
|
||
void DeclarationManagerInterface::registerInterface(py::module& scope, py::dict& globals) | ||
{ | ||
py::class_<ScriptDeclaration> declaration(scope, "Declaration"); | ||
|
||
py::enum_<decl::Type>(declaration, "Type") | ||
.value("None", decl::Type::None) | ||
.value("Material", decl::Type::Material) | ||
.value("Table", decl::Type::Table) | ||
.value("EntityDef", decl::Type::EntityDef) | ||
.value("SoundShader", decl::Type::SoundShader) | ||
.value("ModelDef", decl::Type::ModelDef) | ||
.value("Particle", decl::Type::Particle) | ||
.value("Skin", decl::Type::Skin) | ||
.export_values(); | ||
|
||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#pragma once | ||
|
||
#include "iscriptinterface.h" | ||
#include "ideclmanager.h" | ||
|
||
namespace script | ||
{ | ||
|
||
// Wrapper class to represent an IDeclaration object in Python | ||
class ScriptDeclaration | ||
{ | ||
private: | ||
decl::IDeclaration::Ptr _decl; | ||
|
||
public: | ||
ScriptDeclaration(const decl::IDeclaration::Ptr& decl) : | ||
_decl(decl) | ||
{} | ||
|
||
// TODO | ||
}; | ||
|
||
/** | ||
* Exposes the GlobalDeclarationManager interface to scripts | ||
*/ | ||
class DeclarationManagerInterface : | ||
public IScriptInterface | ||
{ | ||
public: | ||
// Mapped methods | ||
ScriptDeclaration findDeclaration(decl::Type type, const std::string& name); | ||
|
||
// IScriptInterface implementation | ||
void registerInterface(py::module& scope, py::dict& globals) override; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters