mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 13:28:09 +02:00
Merge branch 'master' of https://github.com/highfidelity/hifi into scriptable-anim-var-triggers
This commit is contained in:
commit
e8ffa598a2
13 changed files with 72 additions and 21 deletions
|
@ -102,8 +102,10 @@ void Agent::handleOctreePacket(QSharedPointer<ReceivedMessage> message, SharedNo
|
||||||
packetType = message->getType();
|
packetType = message->getType();
|
||||||
} // fall through to piggyback message
|
} // fall through to piggyback message
|
||||||
|
|
||||||
if (packetType == PacketType::EntityData || packetType == PacketType::EntityErase) {
|
if (packetType == PacketType::EntityData) {
|
||||||
_entityViewer.processDatagram(*message, senderNode);
|
_entityViewer.processDatagram(*message, senderNode);
|
||||||
|
} else if (packetType == PacketType::EntityErase) {
|
||||||
|
_entityViewer.processEraseMessage(*message, senderNode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
cmake/externals/sdl2/CMakeLists.txt
vendored
8
cmake/externals/sdl2/CMakeLists.txt
vendored
|
@ -63,7 +63,11 @@ set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals")
|
||||||
|
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
|
|
||||||
|
# NOOP
|
||||||
|
|
||||||
elseif (WIN32)
|
elseif (WIN32)
|
||||||
|
|
||||||
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
|
ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR)
|
||||||
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${SOURCE_DIR}/include CACHE PATH "Location of SDL2 include directory")
|
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${SOURCE_DIR}/include CACHE PATH "Location of SDL2 include directory")
|
||||||
|
|
||||||
|
@ -75,8 +79,12 @@ elseif (WIN32)
|
||||||
set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${SOURCE_DIR}/lib/x86 CACHE PATH "Location of SDL2 DLL")
|
set(${EXTERNAL_NAME_UPPER}_DLL_PATH ${SOURCE_DIR}/lib/x86 CACHE PATH "Location of SDL2 DLL")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
add_paths_to_fixup_libs(${${EXTERNAL_NAME_UPPER}_DLL_PATH})
|
||||||
|
|
||||||
else ()
|
else ()
|
||||||
|
|
||||||
ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR)
|
ExternalProject_Get_Property(${EXTERNAL_NAME} INSTALL_DIR)
|
||||||
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include/SDL2 CACHE PATH "Location of SDL2 include directory")
|
set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIR ${INSTALL_DIR}/include/SDL2 CACHE PATH "Location of SDL2 include directory")
|
||||||
set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${INSTALL_DIR}/lib/libSDL2.so CACHE FILEPATH "Path to SDL2 library")
|
set(${EXTERNAL_NAME_UPPER}_LIBRARY_TEMP ${INSTALL_DIR}/lib/libSDL2.so CACHE FILEPATH "Path to SDL2 library")
|
||||||
|
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
@ -128,7 +128,6 @@ function setUp() {
|
||||||
blue: 255
|
blue: 255
|
||||||
},
|
},
|
||||||
lifespan: 5.0,
|
lifespan: 5.0,
|
||||||
visible: false,
|
|
||||||
locked: false,
|
locked: false,
|
||||||
isEmitting: true,
|
isEmitting: true,
|
||||||
lifetime: 3600 // 1 hour; just in case
|
lifetime: 3600 // 1 hour; just in case
|
||||||
|
|
|
@ -68,7 +68,6 @@
|
||||||
#include <HFBackEvent.h>
|
#include <HFBackEvent.h>
|
||||||
#include <InfoView.h>
|
#include <InfoView.h>
|
||||||
#include <input-plugins/InputPlugin.h>
|
#include <input-plugins/InputPlugin.h>
|
||||||
#include <input-plugins/Joystick.h> // this should probably be removed
|
|
||||||
#include <controllers/UserInputMapper.h>
|
#include <controllers/UserInputMapper.h>
|
||||||
#include <controllers/StateController.h>
|
#include <controllers/StateController.h>
|
||||||
#include <LogHandler.h>
|
#include <LogHandler.h>
|
||||||
|
@ -4017,13 +4016,6 @@ void Application::saveScripts() {
|
||||||
settings.endArray();
|
settings.endArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
QScriptValue joystickToScriptValue(QScriptEngine *engine, Joystick* const &in) {
|
|
||||||
return engine->newQObject(in);
|
|
||||||
}
|
|
||||||
|
|
||||||
void joystickFromScriptValue(const QScriptValue &object, Joystick* &out) {
|
|
||||||
out = qobject_cast<Joystick*>(object.toQObject());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scriptEngine) {
|
void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scriptEngine) {
|
||||||
// setup the packet senders and jurisdiction listeners of the script engine's scripting interfaces so
|
// setup the packet senders and jurisdiction listeners of the script engine's scripting interfaces so
|
||||||
|
@ -4088,8 +4080,6 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEngine* scri
|
||||||
|
|
||||||
scriptEngine->registerGlobalObject("AvatarManager", DependencyManager::get<AvatarManager>().data());
|
scriptEngine->registerGlobalObject("AvatarManager", DependencyManager::get<AvatarManager>().data());
|
||||||
|
|
||||||
qScriptRegisterMetaType(scriptEngine, joystickToScriptValue, joystickFromScriptValue);
|
|
||||||
|
|
||||||
scriptEngine->registerGlobalObject("UndoStack", &_undoStackScriptingInterface);
|
scriptEngine->registerGlobalObject("UndoStack", &_undoStackScriptingInterface);
|
||||||
|
|
||||||
scriptEngine->registerGlobalObject("LODManager", DependencyManager::get<LODManager>().data());
|
scriptEngine->registerGlobalObject("LODManager", DependencyManager::get<LODManager>().data());
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
set(TARGET_NAME input-plugins)
|
set(TARGET_NAME input-plugins)
|
||||||
setup_hifi_library()
|
setup_hifi_library()
|
||||||
link_hifi_libraries(shared plugins controllers script-engine)
|
link_hifi_libraries(shared plugins controllers)
|
||||||
|
|
||||||
GroupSources("src/input-plugins")
|
GroupSources("src/input-plugins")
|
||||||
|
|
||||||
target_sdl2()
|
|
||||||
|
|
|
@ -13,13 +13,11 @@
|
||||||
#include <plugins/PluginManager.h>
|
#include <plugins/PluginManager.h>
|
||||||
|
|
||||||
#include "KeyboardMouseDevice.h"
|
#include "KeyboardMouseDevice.h"
|
||||||
#include "SDL2Manager.h"
|
|
||||||
|
|
||||||
// TODO migrate to a DLL model where plugins are discovered and loaded at runtime by the PluginManager class
|
// TODO migrate to a DLL model where plugins are discovered and loaded at runtime by the PluginManager class
|
||||||
InputPluginList getInputPlugins() {
|
InputPluginList getInputPlugins() {
|
||||||
InputPlugin* PLUGIN_POOL[] = {
|
InputPlugin* PLUGIN_POOL[] = {
|
||||||
new KeyboardMouseDevice(),
|
new KeyboardMouseDevice(),
|
||||||
new SDL2Manager(),
|
|
||||||
nullptr
|
nullptr
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
12
plugins/hifiSdl2/CMakeLists.txt
Normal file
12
plugins/hifiSdl2/CMakeLists.txt
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
#
|
||||||
|
# Created by Bradley Austin Davis on 2015/11/18
|
||||||
|
# Copyright 2015 High Fidelity, Inc.
|
||||||
|
#
|
||||||
|
# Distributed under the Apache License, Version 2.0.
|
||||||
|
# See the accompanying file LICENSE or http:#www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
#
|
||||||
|
|
||||||
|
set(TARGET_NAME hifiSdl2)
|
||||||
|
setup_hifi_plugin(Script Qml Widgets)
|
||||||
|
link_hifi_libraries(shared controllers plugins input-plugins script-engine)
|
||||||
|
target_sdl2()
|
|
@ -11,8 +11,6 @@
|
||||||
|
|
||||||
#include <qapplication.h>
|
#include <qapplication.h>
|
||||||
|
|
||||||
#include <HFActionEvent.h>
|
|
||||||
#include <HFBackEvent.h>
|
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <controllers/UserInputMapper.h>
|
#include <controllers/UserInputMapper.h>
|
||||||
|
|
||||||
|
@ -163,6 +161,7 @@ void SDL2Manager::pluginUpdate(float deltaTime, bool jointsCaptured) {
|
||||||
joystick->handleButtonEvent(event.cbutton);
|
joystick->handleButtonEvent(event.cbutton);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (event.cbutton.button == SDL_CONTROLLER_BUTTON_BACK) {
|
if (event.cbutton.button == SDL_CONTROLLER_BUTTON_BACK) {
|
||||||
// this will either start or stop a global back event
|
// this will either start or stop a global back event
|
||||||
QEvent::Type backType = (event.type == SDL_CONTROLLERBUTTONDOWN)
|
QEvent::Type backType = (event.type == SDL_CONTROLLERBUTTONDOWN)
|
||||||
|
@ -172,6 +171,7 @@ void SDL2Manager::pluginUpdate(float deltaTime, bool jointsCaptured) {
|
||||||
|
|
||||||
qApp->sendEvent(qApp, &backEvent);
|
qApp->sendEvent(qApp, &backEvent);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
} else if (event.type == SDL_CONTROLLERDEVICEADDED) {
|
} else if (event.type == SDL_CONTROLLERDEVICEADDED) {
|
||||||
SDL_GameController* controller = SDL_GameControllerOpen(event.cdevice.which);
|
SDL_GameController* controller = SDL_GameControllerOpen(event.cdevice.which);
|
|
@ -17,8 +17,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <controllers/UserInputMapper.h>
|
#include <controllers/UserInputMapper.h>
|
||||||
|
#include <input-plugins/InputPlugin.h>
|
||||||
#include "InputPlugin.h"
|
|
||||||
#include "Joystick.h"
|
#include "Joystick.h"
|
||||||
|
|
||||||
class SDL2Manager : public InputPlugin {
|
class SDL2Manager : public InputPlugin {
|
44
plugins/hifiSdl2/src/SDL2Provider.cpp
Normal file
44
plugins/hifiSdl2/src/SDL2Provider.cpp
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
//
|
||||||
|
// Created by Bradley Austin Davis on 2015/10/25
|
||||||
|
// Copyright 2015 High Fidelity, Inc.
|
||||||
|
//
|
||||||
|
// Distributed under the Apache License, Version 2.0.
|
||||||
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <mutex>
|
||||||
|
|
||||||
|
#include <QtCore/QObject>
|
||||||
|
#include <QtCore/QtPlugin>
|
||||||
|
#include <QtCore/QStringList>
|
||||||
|
|
||||||
|
#include <plugins/RuntimePlugin.h>
|
||||||
|
#include <plugins/InputPlugin.h>
|
||||||
|
|
||||||
|
#include "SDL2Manager.h"
|
||||||
|
|
||||||
|
class SDL2Provider : public QObject, public InputProvider {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PLUGIN_METADATA(IID InputProvider_iid FILE "plugin.json")
|
||||||
|
Q_INTERFACES(InputProvider)
|
||||||
|
|
||||||
|
public:
|
||||||
|
SDL2Provider(QObject* parent = nullptr) : QObject(parent) {}
|
||||||
|
virtual ~SDL2Provider() {}
|
||||||
|
|
||||||
|
virtual InputPluginList getInputPlugins() override {
|
||||||
|
static std::once_flag once;
|
||||||
|
std::call_once(once, [&] {
|
||||||
|
InputPluginPointer plugin(new SDL2Manager());
|
||||||
|
if (plugin->isSupported()) {
|
||||||
|
_inputPlugins.push_back(plugin);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return _inputPlugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
InputPluginList _inputPlugins;
|
||||||
|
};
|
||||||
|
|
||||||
|
#include "SDL2Provider.moc"
|
1
plugins/hifiSdl2/src/plugin.json
Normal file
1
plugins/hifiSdl2/src/plugin.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{}
|
Loading…
Reference in a new issue