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