History

resolve conflicts on merge with upstream master

Stephen Birarda committed 11 years ago

Commit 51bba482 parents 6d8f319 b385fe9162 files · +635 −11958Browse files

Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 162 files). Show all

Unified · Split

libraries/script-engine/src/ScriptEngine.cpp+1−38
@@ -28,22 +28,18 @@ · 27 unmodified lines
28#include <NodeList.h>28#include <NodeList.h>
29#include <PacketHeaders.h>29#include <PacketHeaders.h>
30#include <UUID.h>30#include <UUID.h>
31#include <VoxelConstants.h>
32#include <VoxelDetail.h>
33 31
34#include "AnimationObject.h"32#include "AnimationObject.h"
35#include "ArrayBufferViewClass.h"33#include "ArrayBufferViewClass.h"
36#include "DataViewClass.h"34#include "DataViewClass.h"
37#include "EventTypes.h"35#include "EventTypes.h"
38#include "MenuItemProperties.h"36#include "MenuItemProperties.h"
39#include "LocalVoxels.h"
40#include "ScriptEngine.h"37#include "ScriptEngine.h"
41#include "TypedArrays.h"38#include "TypedArrays.h"
42#include "XMLHttpRequestClass.h"39#include "XMLHttpRequestClass.h"
43 40
44#include "MIDIEvent.h"41#include "MIDIEvent.h"
45 42
46VoxelsScriptingInterface ScriptEngine::_voxelsScriptingInterface;
47EntityScriptingInterface ScriptEngine::_entityScriptingInterface;43EntityScriptingInterface ScriptEngine::_entityScriptingInterface;
48 44
49static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine){45static QScriptValue debugPrint(QScriptContext* context, QScriptEngine* engine){
@@ -200,8 +196,6 @@ void ScriptEngine::handleScriptDownload() { · 150 unmodified lines
200 }196 }
201}197}
202 198
203Q_SCRIPT_DECLARE_QMETAOBJECT(LocalVoxels, QString)
204
205void ScriptEngine::init() {199void ScriptEngine::init() {
206 if (_isInitialized) {200 if (_isInitialized) {
207 return; // only initialize once201 return; // only initialize once
@@ -209,12 +203,9 @@ void ScriptEngine::init() { · 1 unmodified line
209 203
210 _isInitialized = true;204 _isInitialized = true;
211 205
212 _voxelsScriptingInterface.init();
213
214 // register various meta-types206 // register various meta-types
215 registerMetaTypes(this);207 registerMetaTypes(this);
216 registerMIDIMetaTypes(this);208 registerMIDIMetaTypes(this);
217 registerVoxelMetaTypes(this);
218 registerEventTypes(this);209 registerEventTypes(this);
219 registerMenuItemProperties(this);210 registerMenuItemProperties(this);
220 registerAnimationTypes(this);211 registerAnimationTypes(this);
@@ -237,9 +228,6 @@ void ScriptEngine::init() { · 16 unmodified lines
237 QScriptValue printConstructorValue = newFunction(debugPrint);228 QScriptValue printConstructorValue = newFunction(debugPrint);
238 globalObject().setProperty("print", printConstructorValue);229 globalObject().setProperty("print", printConstructorValue);
239 230
240 QScriptValue localVoxelsValue = scriptValueFromQMetaObject<LocalVoxels>();
241 globalObject().setProperty("LocalVoxels", localVoxelsValue);
242
243 QScriptValue audioEffectOptionsConstructorValue = newFunction(AudioEffectOptions::constructor);231 QScriptValue audioEffectOptionsConstructorValue = newFunction(AudioEffectOptions::constructor);
244 globalObject().setProperty("AudioEffectOptions", audioEffectOptionsConstructorValue);232 globalObject().setProperty("AudioEffectOptions", audioEffectOptionsConstructorValue);
245 233
@@ -257,19 +245,14 @@ void ScriptEngine::init() { · 11 unmodified lines
257 registerGlobalObject("Uuid", &_uuidLibrary);245 registerGlobalObject("Uuid", &_uuidLibrary);
258 registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data());246 registerGlobalObject("AnimationCache", DependencyManager::get<AnimationCache>().data());
259 247
260 registerGlobalObject("Voxels", &_voxelsScriptingInterface);
261
262 // constants248 // constants
263 globalObject().setProperty("TREE_SCALE", newVariant(QVariant(TREE_SCALE)));249 globalObject().setProperty("TREE_SCALE", newVariant(QVariant(TREE_SCALE)));
264 globalObject().setProperty("COLLISION_GROUP_ENVIRONMENT", newVariant(QVariant(COLLISION_GROUP_ENVIRONMENT)));250 globalObject().setProperty("COLLISION_GROUP_ENVIRONMENT", newVariant(QVariant(COLLISION_GROUP_ENVIRONMENT)));
265 globalObject().setProperty("COLLISION_GROUP_AVATARS", newVariant(QVariant(COLLISION_GROUP_AVATARS)));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 globalObject().setProperty("AVATAR_MOTION_OBEY_LOCAL_GRAVITY", newVariant(QVariant(AVATAR_MOTION_OBEY_LOCAL_GRAVITY)));253 globalObject().setProperty("AVATAR_MOTION_OBEY_LOCAL_GRAVITY", newVariant(QVariant(AVATAR_MOTION_OBEY_LOCAL_GRAVITY)));
269 globalObject().setProperty("AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY", newVariant(QVariant(AVATAR_MOTION_OBEY_ENVIRONMENTAL_GRAVITY)));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
275QScriptValue ScriptEngine::registerGlobalObject(const QString& name, QObject* object) {258QScriptValue ScriptEngine::registerGlobalObject(const QString& name, QObject* object) {
@@ -379,18 +362,8 @@ void ScriptEngine::run() { · 103 unmodified lines
379 break;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 if (_entityScriptingInterface.getEntityPacketSender()->serversExist()) {365 if (_entityScriptingInterface.getEntityPacketSender()->serversExist()) {
393 // release the queue of edit voxel messages.366 // release the queue of edit entity messages.
394 _entityScriptingInterface.getEntityPacketSender()->releaseQueuedMessages();367 _entityScriptingInterface.getEntityPacketSender()->releaseQueuedMessages();
395 368
396 // since we're in non-threaded mode, call process so that the packets are sent369 // 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 // kill the avatar identity timer490 // kill the avatar identity timer
518 delete _avatarIdentityTimer;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 if (_entityScriptingInterface.getEntityPacketSender()->serversExist()) {493 if (_entityScriptingInterface.getEntityPacketSender()->serversExist()) {
531 // release the queue of edit entity messages.494 // release the queue of edit entity messages.
532 _entityScriptingInterface.getEntityPacketSender()->releaseQueuedMessages();495 _entityScriptingInterface.getEntityPacketSender()->releaseQueuedMessages();