mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 06:18:52 +02:00
changes of the day
This commit is contained in:
parent
3a0b2651d5
commit
08dd76c9a8
4 changed files with 56 additions and 56 deletions
|
@ -83,38 +83,56 @@ bool SelectionScriptingInterface::enableListHighlight(const QString& listName, c
|
||||||
auto highlightStyle = _highlightedListMap.find(listName);
|
auto highlightStyle = _highlightedListMap.find(listName);
|
||||||
if (highlightStyle == _highlightedListMap.end()) {
|
if (highlightStyle == _highlightedListMap.end()) {
|
||||||
highlightStyle = _highlightedListMap.insert(listName, SelectionHighlightStyle());
|
highlightStyle = _highlightedListMap.insert(listName, SelectionHighlightStyle());
|
||||||
doSetupHandler = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(*highlightStyle).isBoundToList()) {
|
if (!(*highlightStyle).isBoundToList()) {
|
||||||
GameplayObjects currentList = _selectedItemsListMap.value(listName);
|
auto currentList = _selectedItemsListMap.find(listName);
|
||||||
if (!currentList.getContainsData()) {
|
if (currentList == _selectedItemsListMap.end()) {
|
||||||
_selectedItemsListMap.insert(listName, currentList);
|
_selectedItemsListMap.insert(listName, GameplayObjects());
|
||||||
doSetupHandler = true;
|
setupHandler(listName);
|
||||||
|
// doSetupHandler = true;
|
||||||
}
|
}
|
||||||
(*highlightStyle).setBoundToList(true);
|
(*highlightStyle).setBoundToList(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
(*highlightStyle).fromVariantMap(highlightStyleValues);
|
(*highlightStyle).fromVariantMap(highlightStyleValues);
|
||||||
|
|
||||||
if (doSetupHandler) {
|
/* if (doSetupHandler) {
|
||||||
setupHandler(listName);
|
setupHandler(listName);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
auto mainScene = qApp->getMain3DScene();
|
||||||
|
if (mainScene) {
|
||||||
|
render::Transaction transaction;
|
||||||
|
transaction.resetSelectionHighlight(listName.toStdString(), (*highlightStyle).getStyle());
|
||||||
|
mainScene->enqueueTransaction(transaction);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qWarning() << "SelectionToSceneHandler::highlightStyleChanged(), Unexpected null scene, possibly during application shutdown";
|
||||||
}
|
}
|
||||||
|
|
||||||
emit highlightStyleChanged(listName);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SelectionScriptingInterface::disableListHighlight(const QString& listName) {
|
bool SelectionScriptingInterface::disableListHighlight(const QString& listName) {
|
||||||
auto highlightStyle = _highlightedListMap.find(listName);
|
auto highlightStyle = _highlightedListMap.find(listName);
|
||||||
if (highlightStyle != _highlightedListMap.end()) {
|
if (highlightStyle != _highlightedListMap.end()) {
|
||||||
if ((*highlightStyle).isBoundToList()) {
|
// if ((*highlightStyle).isBoundToList()) {
|
||||||
GameplayObjects currentList = _selectedItemsListMap.value(listName);
|
|
||||||
if (currentList.getContainsData()) {
|
|
||||||
}
|
|
||||||
_highlightedListMap.erase(highlightStyle);
|
_highlightedListMap.erase(highlightStyle);
|
||||||
emit selectedItemsListChanged(listName);
|
|
||||||
}
|
auto mainScene = qApp->getMain3DScene();
|
||||||
|
if (mainScene) {
|
||||||
|
render::Transaction transaction;
|
||||||
|
transaction.removeHighlightFromSelection(listName.toStdString());
|
||||||
|
mainScene->enqueueTransaction(transaction);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qWarning() << "SelectionToSceneHandler::highlightStyleChanged(), Unexpected null scene, possibly during application shutdown";
|
||||||
|
}
|
||||||
|
// emit highlightStyleRemoved(listName);
|
||||||
|
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -126,7 +144,7 @@ QVariantMap SelectionScriptingInterface::getListHighlightStyle(const QString& li
|
||||||
|
|
||||||
render::HighlightStyle SelectionScriptingInterface::getHighlightStyle(const QString& listName) const {
|
render::HighlightStyle SelectionScriptingInterface::getHighlightStyle(const QString& listName) const {
|
||||||
auto highlightStyle = _highlightedListMap.find(listName);
|
auto highlightStyle = _highlightedListMap.find(listName);
|
||||||
if (highlightStyle != _highlightedListMap.end()) {
|
if (highlightStyle == _highlightedListMap.end()) {
|
||||||
return render::HighlightStyle();
|
return render::HighlightStyle();
|
||||||
} else {
|
} else {
|
||||||
return (*highlightStyle).getStyle();
|
return (*highlightStyle).getStyle();
|
||||||
|
@ -196,14 +214,6 @@ bool SelectionScriptingInterface::removeListFromMap(const QString& listName) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionScriptingInterface::onSelectedItemsListChanged(const QString& listName) {
|
|
||||||
emit selectedItemsListChanged(listName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectionScriptingInterface::onHighlightStyleChanged(const QString& listName) {
|
|
||||||
emit onHighlightStyleChanged(listName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectionScriptingInterface::setupHandler(const QString& selectionName) {
|
void SelectionScriptingInterface::setupHandler(const QString& selectionName) {
|
||||||
auto handler = _handlerMap.find(selectionName);
|
auto handler = _handlerMap.find(selectionName);
|
||||||
if (handler == _handlerMap.end()) {
|
if (handler == _handlerMap.end()) {
|
||||||
|
@ -223,14 +233,9 @@ void SelectionToSceneHandler::initialize(const QString& listName) {
|
||||||
_listName = listName;
|
_listName = listName;
|
||||||
|
|
||||||
connect(&(*DependencyManager::get<SelectionScriptingInterface>()), &SelectionScriptingInterface::selectedItemsListChanged, this, &SelectionToSceneHandler::selectedItemsListChanged);
|
connect(&(*DependencyManager::get<SelectionScriptingInterface>()), &SelectionScriptingInterface::selectedItemsListChanged, this, &SelectionToSceneHandler::selectedItemsListChanged);
|
||||||
connect(&(*DependencyManager::get<SelectionScriptingInterface>()), &SelectionScriptingInterface::highlightStyleChanged, this, &SelectionToSceneHandler::highlightStyleChanged);
|
// connect(&(*DependencyManager::get<SelectionScriptingInterface>()), &SelectionScriptingInterface::highlightStyleChanged, this, &SelectionToSceneHandler::highlightStyleChanged);
|
||||||
|
// connect(&(*DependencyManager::get<SelectionScriptingInterface>()), &SelectionScriptingInterface::highlightStyleRemoved, this, &SelectionToSceneHandler::highlightStyleRemoved);
|
||||||
|
|
||||||
auto mainScene = qApp->getMain3DScene();
|
|
||||||
if (mainScene) {
|
|
||||||
render::Transaction transaction;
|
|
||||||
transaction.resetSelectionHighlight(listName.toStdString(), DependencyManager::get<SelectionScriptingInterface>()->getHighlightStyle(listName));
|
|
||||||
mainScene->enqueueTransaction(transaction);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectionToSceneHandler::selectedItemsListChanged(const QString& listName) {
|
void SelectionToSceneHandler::selectedItemsListChanged(const QString& listName) {
|
||||||
|
@ -284,25 +289,36 @@ void SelectionToSceneHandler::updateSceneFromSelectedList() {
|
||||||
qWarning() << "SelectionToSceneHandler::updateRendererSelectedList(), Unexpected null scene, possibly during application shutdown";
|
qWarning() << "SelectionToSceneHandler::updateRendererSelectedList(), Unexpected null scene, possibly during application shutdown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
void SelectionToSceneHandler::highlightStyleChanged(const QString& listName) {
|
void SelectionToSceneHandler::highlightStyleChanged(const QString& listName) {
|
||||||
if (listName == _listName) {
|
if (listName == _listName) {
|
||||||
auto mainScene = qApp->getMain3DScene();
|
auto mainScene = qApp->getMain3DScene();
|
||||||
if (mainScene) {
|
if (mainScene) {
|
||||||
auto thisStyle = DependencyManager::get<SelectionScriptingInterface>()->getHighlightStyle(listName);
|
auto thisStyle = DependencyManager::get<SelectionScriptingInterface>()->getHighlightStyle(listName);
|
||||||
render::Transaction transaction;
|
render::Transaction transaction;
|
||||||
render::ItemIDs finalList;
|
|
||||||
|
|
||||||
transaction.resetSelectionHighlight(listName.toStdString(), thisStyle);
|
transaction.resetSelectionHighlight(listName.toStdString(), thisStyle);
|
||||||
|
|
||||||
mainScene->enqueueTransaction(transaction);
|
mainScene->enqueueTransaction(transaction);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
qWarning() << "SelectionToSceneHandler::updateRendererSelectedList(), Unexpected null scene, possibly during application shutdown";
|
qWarning() << "SelectionToSceneHandler::highlightStyleChanged(), Unexpected null scene, possibly during application shutdown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SelectionToSceneHandler::highlightStyleRemoved(const QString& listName) {
|
||||||
|
if (listName == _listName) {
|
||||||
|
auto mainScene = qApp->getMain3DScene();
|
||||||
|
if (mainScene) {
|
||||||
|
render::Transaction transaction;
|
||||||
|
transaction.removeHighlightFromSelection(listName.toStdString());
|
||||||
|
mainScene->enqueueTransaction(transaction);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
qWarning() << "SelectionToSceneHandler::highlightStyleRemoved(), Unexpected null scene, possibly during application shutdown";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
bool SelectionHighlightStyle::fromVariantMap(const QVariantMap& properties) {
|
bool SelectionHighlightStyle::fromVariantMap(const QVariantMap& properties) {
|
||||||
auto outlineColor = properties["outlineColor"];
|
auto outlineColor = properties["outlineColor"];
|
||||||
if (outlineColor.isValid()) {
|
if (outlineColor.isValid()) {
|
||||||
|
|
|
@ -59,7 +59,8 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void selectedItemsListChanged(const QString& listName);
|
void selectedItemsListChanged(const QString& listName);
|
||||||
void highlightStyleChanged(const QString& listName);
|
// void highlightStyleChanged(const QString& listName);
|
||||||
|
// void highlightStyleRemoved(const QString& listName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString _listName{ "" };
|
QString _listName{ "" };
|
||||||
|
@ -137,12 +138,10 @@ public:
|
||||||
|
|
||||||
render::HighlightStyle getHighlightStyle(const QString& listName) const;
|
render::HighlightStyle getHighlightStyle(const QString& listName) const;
|
||||||
|
|
||||||
void onSelectedItemsListChanged(const QString& listName);
|
|
||||||
void onHighlightStyleChanged(const QString& listName);
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void selectedItemsListChanged(const QString& listName);
|
void selectedItemsListChanged(const QString& listName);
|
||||||
void highlightStyleChanged(const QString& listName);
|
// void highlightStyleChanged(const QString& listName);
|
||||||
|
// void highlightStyleRemoved(const QString& listName);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QMap<QString, GameplayObjects> _selectedItemsListMap;
|
QMap<QString, GameplayObjects> _selectedItemsListMap;
|
||||||
|
@ -154,6 +153,8 @@ private:
|
||||||
template <class T> bool removeFromGameplayObjects(const QString& listName, T idToRemove);
|
template <class T> bool removeFromGameplayObjects(const QString& listName, T idToRemove);
|
||||||
|
|
||||||
void setupHandler(const QString& selectionName);
|
void setupHandler(const QString& selectionName);
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // hifi_SelectionScriptingInterface_h
|
#endif // hifi_SelectionScriptingInterface_h
|
||||||
|
|
|
@ -70,14 +70,6 @@ ContextOverlayInterface::ContextOverlayInterface() {
|
||||||
|
|
||||||
{
|
{
|
||||||
_selectionScriptingInterface->enableListHighlight("contextOverlayHighlightList", QVariantMap());
|
_selectionScriptingInterface->enableListHighlight("contextOverlayHighlightList", QVariantMap());
|
||||||
/* render::Transaction transaction;
|
|
||||||
initializeSelectionToSceneHandler(_selectionToSceneHandlers[0], "contextOverlayHighlightList", transaction);
|
|
||||||
for (auto i = 1; i < MAX_SELECTION_COUNT; i++) {
|
|
||||||
auto selectionName = QString("highlightList") + QString::number(i);
|
|
||||||
initializeSelectionToSceneHandler(_selectionToSceneHandlers[i], selectionName, transaction);
|
|
||||||
}
|
|
||||||
const render::ScenePointer& scene = qApp->getMain3DScene();
|
|
||||||
scene->enqueueTransaction(transaction);*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto nodeList = DependencyManager::get<NodeList>();
|
auto nodeList = DependencyManager::get<NodeList>();
|
||||||
|
@ -86,12 +78,6 @@ ContextOverlayInterface::ContextOverlayInterface() {
|
||||||
_challengeOwnershipTimeoutTimer.setSingleShot(true);
|
_challengeOwnershipTimeoutTimer.setSingleShot(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ContextOverlayInterface::initializeSelectionToSceneHandler(SelectionToSceneHandler& handler, const QString& selectionName, render::Transaction& transaction) {
|
|
||||||
handler.initialize(selectionName);
|
|
||||||
connect(_selectionScriptingInterface.data(), &SelectionScriptingInterface::selectedItemsListChanged, &handler, &SelectionToSceneHandler::selectedItemsListChanged);
|
|
||||||
transaction.resetSelectionHighlight(selectionName.toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
static const uint32_t MOUSE_HW_ID = 0;
|
static const uint32_t MOUSE_HW_ID = 0;
|
||||||
static const uint32_t LEFT_HAND_HW_ID = 1;
|
static const uint32_t LEFT_HAND_HW_ID = 1;
|
||||||
static const xColor CONTEXT_OVERLAY_COLOR = { 255, 255, 255 };
|
static const xColor CONTEXT_OVERLAY_COLOR = { 255, 255, 255 };
|
||||||
|
|
|
@ -96,9 +96,6 @@ private:
|
||||||
void disableEntityHighlight(const EntityItemID& entityItemID);
|
void disableEntityHighlight(const EntityItemID& entityItemID);
|
||||||
|
|
||||||
void deletingEntity(const EntityItemID& entityItemID);
|
void deletingEntity(const EntityItemID& entityItemID);
|
||||||
void initializeSelectionToSceneHandler(SelectionToSceneHandler& handler, const QString& selectionName, render::Transaction& transaction);
|
|
||||||
|
|
||||||
SelectionToSceneHandler _selectionToSceneHandlers[MAX_SELECTION_COUNT];
|
|
||||||
|
|
||||||
Q_INVOKABLE void startChallengeOwnershipTimer();
|
Q_INVOKABLE void startChallengeOwnershipTimer();
|
||||||
QTimer _challengeOwnershipTimeoutTimer;
|
QTimer _challengeOwnershipTimeoutTimer;
|
||||||
|
|
Loading…
Reference in a new issue