Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#6092: Add FX-related script interfaces (WIP)
- Loading branch information
1 parent
d959c2b
commit de2ae8a
Showing
8 changed files
with
84 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
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,27 @@ | ||
#include "FxManagerInterface.h" | ||
|
||
namespace script | ||
{ | ||
|
||
ScriptFxDeclaration FxManagerInterface::findFx(const std::string& name) | ||
{ | ||
return ScriptFxDeclaration(GlobalFxManager().findFx(name)); | ||
} | ||
|
||
void FxManagerInterface::registerInterface(py::module& scope, py::dict& globals) | ||
{ | ||
// Add the EntityNode interface | ||
py::class_<ScriptFxDeclaration, ScriptDeclaration> fxDeclaration(scope, "Fx"); | ||
fxDeclaration.def(py::init<const fx::IFxDeclaration::Ptr&>()); | ||
|
||
// Add the FxManager module declaration to the given python namespace | ||
py::class_<FxManagerInterface> fxManager(scope, "FxManager"); | ||
|
||
// Add both overloads to createEntity | ||
fxManager.def("findFx", &FxManagerInterface::findFx); | ||
|
||
// Now point the Python variable "GlobalFxManager" to this instance | ||
globals["GlobalFxManager"] = this; | ||
} | ||
|
||
} |
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,36 @@ | ||
#pragma once | ||
|
||
#include "ifx.h" | ||
#include "DeclarationManagerInterface.h" | ||
|
||
namespace script | ||
{ | ||
|
||
class ScriptFxDeclaration : | ||
public ScriptDeclaration | ||
{ | ||
private: | ||
fx::IFxDeclaration::Ptr _fx; | ||
|
||
public: | ||
ScriptFxDeclaration(const fx::IFxDeclaration::Ptr& fx) : | ||
ScriptDeclaration(fx), | ||
_fx(fx) | ||
{} | ||
}; | ||
|
||
/** | ||
* Exposes the GlobalFxManager interface to scripts | ||
*/ | ||
class FxManagerInterface : | ||
public IScriptInterface | ||
{ | ||
public: | ||
// Mapped methods | ||
ScriptFxDeclaration findFx(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