| 1 |
#include "FxManagerInterface.h" |
| 2 |
|
| 3 |
namespace script |
| 4 |
{ |
| 5 |
|
| 6 |
ScriptFxDeclaration FxManagerInterface::findFx(const std::string& name) |
| 7 |
{ |
| 8 |
return ScriptFxDeclaration(GlobalFxManager().findFx(name)); |
| 9 |
} |
| 10 |
|
| 11 |
void FxManagerInterface::registerInterface(py::module& scope, py::dict& globals) |
| 12 |
{ |
| 13 |
py::class_<ScriptFxAction> fxAction(scope, "FxAction"); |
| 14 |
|
| 15 |
// FxAction::Type |
| 16 |
py::enum_<fx::IFxAction::Type>(fxAction, "Type") |
| 17 |
.value("Undefined", fx::IFxAction::Type::Undefined) |
| 18 |
.value("Light", fx::IFxAction::Type::Light) |
| 19 |
.value("Particle", fx::IFxAction::Type::Particle) |
| 20 |
.value("Decal", fx::IFxAction::Type::Decal) |
| 21 |
.value("Model", fx::IFxAction::Type::Model) |
| 22 |
.value("Sound", fx::IFxAction::Type::Sound) |
| 23 |
.value("Shake", fx::IFxAction::Type::Shake) |
| 24 |
.value("AttachLight", fx::IFxAction::Type::AttachLight) |
| 25 |
.value("AttachEntity", fx::IFxAction::Type::AttachEntity) |
| 26 |
.value("Launch", fx::IFxAction::Type::Launch) |
| 27 |
.value("Shockwave", fx::IFxAction::Type::Shockwave) |
| 28 |
.export_values(); |
| 29 |
|
| 30 |
// Add the Fx Action methods |
| 31 |
fxAction.def(py::init<const fx::IFxAction::Ptr&>()) |
| 32 |
.def("getActionType", &ScriptFxAction::getActionType) |
| 33 |
.def("getName", &ScriptFxAction::getName) |
| 34 |
.def("getDelayInSeconds", &ScriptFxAction::getDelayInSeconds) |
| 35 |
.def("getDurationInSeconds", &ScriptFxAction::getDurationInSeconds) |
| 36 |
.def("getIgnoreMaster", &ScriptFxAction::getIgnoreMaster) |
| 37 |
.def("getShakeTimeInSeconds", &ScriptFxAction::getShakeTimeInSeconds) |
| 38 |
.def("getShakeAmplitude", &ScriptFxAction::getShakeAmplitude) |
| 39 |
.def("getShakeDistance", &ScriptFxAction::getShakeDistance) |
| 40 |
.def("getShakeFalloff", &ScriptFxAction::getShakeFalloff) |
| 41 |
.def("getShakeImpulse", &ScriptFxAction::getShakeImpulse) |
| 42 |
.def("getNoShadows", &ScriptFxAction::getNoShadows) |
| 43 |
.def("getFireSiblingAction", &ScriptFxAction::getFireSiblingAction) |
| 44 |
.def("getRandomDelay", &ScriptFxAction::getRandomDelay) |
| 45 |
.def("getRotate", &ScriptFxAction::getRotate) |
| 46 |
.def("getTrackOrigin", &ScriptFxAction::getTrackOrigin) |
| 47 |
.def("getRestart", &ScriptFxAction::getRestart) |
| 48 |
.def("getFadeInTimeInSeconds", &ScriptFxAction::getFadeInTimeInSeconds) |
| 49 |
.def("getFadeOutTimeInSeconds", &ScriptFxAction::getFadeOutTimeInSeconds) |
| 50 |
.def("getDecalSize", &ScriptFxAction::getDecalSize) |
| 51 |
.def("getOffset", &ScriptFxAction::getOffset) |
| 52 |
.def("getAxis", &ScriptFxAction::getAxis) |
| 53 |
.def("getAngle", &ScriptFxAction::getAngle) |
| 54 |
.def("getUseLight", &ScriptFxAction::getUseLight) |
| 55 |
.def("getUseModel", &ScriptFxAction::getUseModel) |
| 56 |
.def("getAttachLight", &ScriptFxAction::getAttachLight) |
| 57 |
.def("getAttachEntity", &ScriptFxAction::getAttachEntity) |
| 58 |
.def("getLaunchProjectileDef", &ScriptFxAction::getLaunchProjectileDef) |
| 59 |
.def("getLightMaterialName", &ScriptFxAction::getLightMaterialName) |
| 60 |
.def("getLightRgbColour", &ScriptFxAction::getLightRgbColour) |
| 61 |
.def("getLightRadius", &ScriptFxAction::getLightRadius) |
| 62 |
.def("getModelName", &ScriptFxAction::getModelName) |
| 63 |
.def("getDecalMaterialName", &ScriptFxAction::getDecalMaterialName) |
| 64 |
.def("getParticleTrackVelocity", &ScriptFxAction::getParticleTrackVelocity) |
| 65 |
.def("getSoundShaderName", &ScriptFxAction::getSoundShaderName) |
| 66 |
.def("getShockwaveDefName", &ScriptFxAction::getShockwaveDefName); |
| 67 |
|
| 68 |
// Add the Fx Declaration interface |
| 69 |
py::class_<ScriptFxDeclaration, ScriptDeclaration> fxDeclaration(scope, "Fx"); |
| 70 |
fxDeclaration.def(py::init<const fx::IFxDeclaration::Ptr&>()); |
| 71 |
fxDeclaration.def("isNull", &ScriptFxDeclaration::isNull); |
| 72 |
fxDeclaration.def("getBindTo", &ScriptFxDeclaration::getBindTo); |
| 73 |
fxDeclaration.def("getNumActions", &ScriptFxDeclaration::getNumActions); |
| 74 |
fxDeclaration.def("getAction", &ScriptFxDeclaration::getAction); |
| 75 |
|
| 76 |
// Add the FxManager module declaration to the given python namespace |
| 77 |
py::class_<FxManagerInterface> fxManager(scope, "FxManager"); |
| 78 |
|
| 79 |
// Add both overloads to createEntity |
| 80 |
fxManager.def("findFx", &FxManagerInterface::findFx); |
| 81 |
|
| 82 |
// Now point the Python variable "GlobalFxManager" to this instance |
| 83 |
globals["GlobalFxManager"] = this; |
| 84 |
} |
| 85 |
|
| 86 |
} |