Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 65 files). Show all
Unified · Split
| @@ -28,22 +28,19 @@ · 27 unmodified lines | ||
| 28 | 28 | #include <NodeList.h> |
| 29 | 29 | #include <PacketHeaders.h> |
| 30 | 30 | #include <UUID.h> |
| 31 | −#include <VoxelConstants.h> | |
| 32 | −#include <VoxelDetail.h> | |
| 31 | +//#include <VoxelConstants.h> | |
| 33 | 32 | |
| 34 | 33 | #include "AnimationObject.h" |
| 35 | 34 | #include "ArrayBufferViewClass.h" |
| 36 | 35 | #include "DataViewClass.h" |
| 37 | 36 | #include "EventTypes.h" |
| 38 | 37 | #include "MenuItemProperties.h" |
| 39 | −#include "LocalVoxels.h" | |
| 40 | 38 | #include "ScriptEngine.h" |
| 41 | 39 | #include "TypedArrays.h" |
| 42 | 40 | #include "XMLHttpRequestClass.h" |
| 43 | 41 | |
| 44 | 42 | #include "MIDIEvent.h" |
| 45 | 43 | |
| 46 | −VoxelsScriptingInterface ScriptEngine::_voxelsScriptingInterface; | |
| 47 | 44 | EntityScriptingInterface ScriptEngine::_entityScriptingInterface; |
| 48 | 45 | |
| 49 | 46 | static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine){ |
| @@ -200,8 +197,6 @@ void ScriptEngine::handleScriptDownload() { · 150 unmodified lines | ||
| 200 | 197 | } |
| 201 | 198 | } |
| 202 | 199 | |
| 203 | −Q_SCRIPT_DECLARE_QMETAOBJECT(LocalVoxels, QString) | |
| 204 | − | |
| 205 | 200 | void ScriptEngine::init() { |
| 206 | 201 | if (_isInitialized) { |
| 207 | 202 | return; // only initialize once |
| @@ -209,12 +204,9 @@ void ScriptEngine::init() { · 1 unmodified line | ||
| 209 | 204 | |
| 210 | 205 | _isInitialized = true; |
| 211 | 206 | |
| 212 | − _voxelsScriptingInterface.init(); | |
| 213 | − | |
| 214 | 207 | // register various meta-types |
| 215 | 208 | registerMetaTypes(this); |
| 216 | 209 | registerMIDIMetaTypes(this); |
| 217 | − registerVoxelMetaTypes(this); | |
| 218 | 210 | registerEventTypes(this); |
| 219 | 211 | registerMenuItemProperties(this); |
| 220 | 212 | registerAnimationTypes(this); |
| @@ -237,9 +229,6 @@ void ScriptEngine::init() { · 16 unmodified lines | ||
| 237 | 229 | QScriptValue printConstructorValue = newFunction(debugPrint); |
| 238 | 230 | globalObject().setProperty("print", printConstructorValue); |
| 239 | 231 | |
| 240 | − QScriptValue localVoxelsValue = scriptValueFromQMetaObject<LocalVoxels>(); | |
| 241 | − globalObject().setProperty("LocalVoxels", localVoxelsValue); | |
| 242 | − | |
| 243 | 232 | QScriptValue audioEffectOptionsConstructorValue = newFunction(AudioEffectOptions::constructor); |
| 244 | 233 | globalObject().setProperty("AudioEffectOptions", audioEffectOptionsConstructorValue); |
| 245 | 234 | |
| @@ -257,19 +246,14 @@ void ScriptEngine::init() { · 11 unmodified lines | ||
| 257 | 246 | registerGlobalObject("Uuid", &_uuidLibrary); |
| 258 | 247 | registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data()); |
| 259 | 248 | |
| 260 | − registerGlobalObject("Voxels", &_voxelsScriptingInterface); | |
| 261 | − | |
| 262 | 249 | // constants |
| 263 | 250 | globalObject().setProperty("TREE_SCALE", newVariant(QVariant(TREE_SCALE))); |
| 264 | 251 | globalObject().setProperty("COLLISION_GROUP_ENVIRONMENT", newVariant(QVariant(COLLISION_GROUP_ENVIRONMENT))); |
| 265 | 252 | globalObject().setProperty("COLLISION_GROUP_AVATARS", newVariant(QVariant(COLLISION_GROUP_AVATARS))); |
| 266 | − globalObject().setProperty("COLLISION_GROUP_VOXELS", newVariant(QVariant(COLLISION_GROUP_VOXELS))); | |
| 267 | 253 | |
| 268 | 254 | globalObject().setProperty("AVATAR_MOTION_OBEY_LOCAL_GRAVITY", newVariant(QVariant(AVATAR_MOTION_OBEY_LOCAL_GRAVITY))); |
| 269 | 255 | globalObject().setProperty("AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY", newVariant(QVariant(AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY))); |
| 270 | 256 | |
| 271 | − // let the VoxelPacketSender know how frequently we plan to call it | |
| 272 | − _voxelsScriptingInterface.getVoxelPacketSender()->setProcessCallIntervalHint(SCRIPT_DATA_CALLBACK_USECS); | |
| 273 | 257 | } |
| 274 | 258 | |
| 275 | 259 | QScriptValue ScriptEngine::registerGlobalObject(const QString& name, QObject* object) { |
| @@ -379,18 +363,8 @@ void ScriptEngine::run() { · 103 unmodified lines | ||
| 379 | 363 | break; |
| 380 | 364 | } |
| 381 | 365 | |
| 382 | − if (_voxelsScriptingInterface.getVoxelPacketSender()->serversExist()) { | |
| 383 | − // release the queue of edit voxel messages. | |
| 384 | − _voxelsScriptingInterface.getVoxelPacketSender()->releaseQueuedMessages(); | |
| 385 | − | |
| 386 | − // since we're in non-threaded mode, call process so that the packets are sent | |
| 387 | − if (!_voxelsScriptingInterface.getVoxelPacketSender()->isThreaded()) { | |
| 388 | − _voxelsScriptingInterface.getVoxelPacketSender()->process(); | |
| 389 | − } | |
| 390 | − } | |
| 391 | − | |
| 392 | 366 | if (_entityScriptingInterface.getEntityPacketSender()->serversExist()) { |
| 393 | − // release the queue of edit voxel messages. | |
| 367 | + // release the queue of edit entity messages. | |
| 394 | 368 | _entityScriptingInterface.getEntityPacketSender()->releaseQueuedMessages(); |
| 395 | 369 | |
| 396 | 370 | // since we're in non-threaded mode, call process so that the packets are sent |
| @@ -516,16 +490,6 @@ void ScriptEngine::run() { · 119 unmodified lines | ||
| 516 | 490 | // kill the avatar identity timer |
| 517 | 491 | delete _avatarIdentityTimer; |
| 518 | 492 | |
| 519 | − if (_voxelsScriptingInterface.getVoxelPacketSender()->serversExist()) { | |
| 520 | − // release the queue of edit voxel messages. | |
| 521 | − _voxelsScriptingInterface.getVoxelPacketSender()->releaseQueuedMessages(); | |
| 522 | − | |
| 523 | − // since we're in non-threaded mode, call process so that the packets are sent | |
| 524 | − if (!_voxelsScriptingInterface.getVoxelPacketSender()->isThreaded()) { | |
| 525 | − _voxelsScriptingInterface.getVoxelPacketSender()->process(); | |
| 526 | − } | |
| 527 | − } | |
| 528 | − | |
| 529 | 493 | if (_entityScriptingInterface.getEntityPacketSender()->serversExist()) { |
| 530 | 494 | // release the queue of edit entity messages. |
| 531 | 495 | _entityScriptingInterface.getEntityPacketSender()->releaseQueuedMessages(); |