Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 11 files). Show all
Unified · Split
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | // |
| 2 | −// Agent.cpp | |
| 2 | +// ScriptEngine.cpp | |
| 3 | 3 | // hifi |
| 4 | 4 | // |
| 5 | 5 | // Created by Brad Hefta-Gaub on 12/14/13. |
| @@ -23,8 +23,8 @@ · 17 unmodified lines | ||
| 23 | 23 | #include "ScriptEngine.h" |
| 24 | 24 | |
| 25 | 25 | int ScriptEngine::_scriptNumber = 1; |
| 26 | −VoxelScriptingInterface ScriptEngine::_voxelScriptingInterface; | |
| 27 | −ParticleScriptingInterface ScriptEngine::_particleScriptingInterface; | |
| 26 | +VoxelsScriptingInterface ScriptEngine::_voxelsScriptingInterface; | |
| 27 | +ParticlesScriptingInterface ScriptEngine::_particlesScriptingInterface; | |
| 28 | 28 | |
| 29 | 29 | |
| 30 | 30 | ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, |
| @@ -49,11 +49,11 @@ ScriptEngine::ScriptEngine(const QString& scriptContents, bool wantMenuItems, · 18 unmodified lines | ||
| 49 | 49 | |
| 50 | 50 | // hook up our interfaces |
| 51 | 51 | if (!Particle::getVoxelsScriptingInterface()) { |
| 52 | − Particle::setVoxelsScriptingInterface(getVoxelScriptingInterface()); | |
| 52 | + Particle::setVoxelsScriptingInterface(getVoxelsScriptingInterface()); | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | if (!Particle::getParticlesScriptingInterface()) { |
| 56 | − Particle::setParticlesScriptingInterface(getParticleScriptingInterface()); | |
| 56 | + Particle::setParticlesScriptingInterface(getParticlesScriptingInterface()); | |
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
| @@ -86,8 +86,8 @@ void ScriptEngine::run() { · 26 unmodified lines | ||
| 86 | 86 | _isRunning = true; |
| 87 | 87 | QScriptEngine engine; |
| 88 | 88 | |
| 89 | − _voxelScriptingInterface.init(); | |
| 90 | − _particleScriptingInterface.init(); | |
| 89 | + _voxelsScriptingInterface.init(); | |
| 90 | + _particlesScriptingInterface.init(); | |
| 91 | 91 | |
| 92 | 92 | // register meta-type for glm::vec3 conversions |
| 93 | 93 | registerMetaTypes(&engine); |
| @@ -95,10 +95,10 @@ void ScriptEngine::run() { · 1 unmodified line | ||
| 95 | 95 | QScriptValue agentValue = engine.newQObject(this); |
| 96 | 96 | engine.globalObject().setProperty("Agent", agentValue); |
| 97 | 97 | |
| 98 | − QScriptValue voxelScripterValue = engine.newQObject(&_voxelScriptingInterface); | |
| 98 | + QScriptValue voxelScripterValue = engine.newQObject(&_voxelsScriptingInterface); | |
| 99 | 99 | engine.globalObject().setProperty("Voxels", voxelScripterValue); |
| 100 | 100 | |
| 101 | − QScriptValue particleScripterValue = engine.newQObject(&_particleScriptingInterface); | |
| 101 | + QScriptValue particleScripterValue = engine.newQObject(&_particlesScriptingInterface); | |
| 102 | 102 | engine.globalObject().setProperty("Particles", particleScripterValue); |
| 103 | 103 | |
| 104 | 104 | if (_controllerScriptingInterface) { |
| @@ -112,8 +112,8 @@ void ScriptEngine::run() { · 7 unmodified lines | ||
| 112 | 112 | const unsigned int VISUAL_DATA_CALLBACK_USECS = (1.0 / 60.0) * 1000 * 1000; |
| 113 | 113 | |
| 114 | 114 | // let the VoxelPacketSender know how frequently we plan to call it |
| 115 | − _voxelScriptingInterface.getVoxelPacketSender()->setProcessCallIntervalHint(VISUAL_DATA_CALLBACK_USECS); | |
| 116 | − _particleScriptingInterface.getParticlePacketSender()->setProcessCallIntervalHint(VISUAL_DATA_CALLBACK_USECS); | |
| 115 | + _voxelsScriptingInterface.getVoxelPacketSender()->setProcessCallIntervalHint(VISUAL_DATA_CALLBACK_USECS); | |
| 116 | + _particlesScriptingInterface.getParticlePacketSender()->setProcessCallIntervalHint(VISUAL_DATA_CALLBACK_USECS); | |
| 117 | 117 | |
| 118 | 118 | //qDebug() << "Script:\n" << _scriptContents << "\n"; |
| 119 | 119 | |
| @@ -147,29 +147,29 @@ void ScriptEngine::run() { · 27 unmodified lines | ||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | bool willSendVisualDataCallBack = false; |
| 150 | − if (_voxelScriptingInterface.getVoxelPacketSender()->serversExist()) { | |
| 150 | + if (_voxelsScriptingInterface.getVoxelPacketSender()->serversExist()) { | |
| 151 | 151 | // allow the scripter's call back to setup visual data |
| 152 | 152 | willSendVisualDataCallBack = true; |
| 153 | 153 | |
| 154 | 154 | // release the queue of edit voxel messages. |
| 155 | − _voxelScriptingInterface.getVoxelPacketSender()->releaseQueuedMessages(); | |
| 155 | + _voxelsScriptingInterface.getVoxelPacketSender()->releaseQueuedMessages(); | |
| 156 | 156 | |
| 157 | 157 | // since we're in non-threaded mode, call process so that the packets are sent |
| 158 | − if (!_voxelScriptingInterface.getVoxelPacketSender()->isThreaded()) { | |
| 159 | − _voxelScriptingInterface.getVoxelPacketSender()->process(); | |
| 158 | + if (!_voxelsScriptingInterface.getVoxelPacketSender()->isThreaded()) { | |
| 159 | + _voxelsScriptingInterface.getVoxelPacketSender()->process(); | |
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | |
| 163 | − if (_particleScriptingInterface.getParticlePacketSender()->serversExist()) { | |
| 163 | + if (_particlesScriptingInterface.getParticlePacketSender()->serversExist()) { | |
| 164 | 164 | // allow the scripter's call back to setup visual data |
| 165 | 165 | willSendVisualDataCallBack = true; |
| 166 | 166 | |
| 167 | 167 | // release the queue of edit voxel messages. |
| 168 | − _particleScriptingInterface.getParticlePacketSender()->releaseQueuedMessages(); | |
| 168 | + _particlesScriptingInterface.getParticlePacketSender()->releaseQueuedMessages(); | |
| 169 | 169 | |
| 170 | 170 | // since we're in non-threaded mode, call process so that the packets are sent |
| 171 | − if (!_particleScriptingInterface.getParticlePacketSender()->isThreaded()) { | |
| 172 | − _particleScriptingInterface.getParticlePacketSender()->process(); | |
| 171 | + if (!_particlesScriptingInterface.getParticlePacketSender()->isThreaded()) { | |
| 172 | + _particlesScriptingInterface.getParticlePacketSender()->process(); | |
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |