mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 21:18:43 +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);
|
||||
if (highlightStyle == _highlightedListMap.end()) {
|
||||
highlightStyle = _highlightedListMap.insert(listName, SelectionHighlightStyle());
|
||||
doSetupHandler = true;
|
||||
|
||||
}
|
||||
|
||||
if (!(*highlightStyle).isBoundToList()) {
|
||||
GameplayObjects currentList = _selectedItemsListMap.value(listName);
|
||||
if (!currentList.getContainsData()) {
|
||||
_selectedItemsListMap.insert(listName, currentList);
|
||||
doSetupHandler = true;
|
||||
auto currentList = _selectedItemsListMap.find(listName);
|
||||
if (currentList == _selectedItemsListMap.end()) {
|
||||
_selectedItemsListMap.insert(listName, GameplayObjects());
|
||||
setupHandler(listName);
|
||||
// doSetupHandler = true;
|
||||
}
|
||||
(*highlightStyle).setBoundToList(true);
|
||||
}
|
||||
|
||||
(*highlightStyle).fromVariantMap(highlightStyleValues);
|
||||
|
||||
if (doSetupHandler) {
|
||||
/* if (doSetupHandler) {
|
||||
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;
|
||||
}
|
||||
|
||||
bool SelectionScriptingInterface::disableListHighlight(const QString& listName) {
|
||||
auto highlightStyle = _highlightedListMap.find(listName);
|
||||
if (highlightStyle != _highlightedListMap.end()) {
|
||||
if ((*highlightStyle).isBoundToList()) {
|
||||
GameplayObjects currentList = _selectedItemsListMap.value(listName);
|
||||
if (currentList.getContainsData()) {
|
||||
}
|
||||
// if ((*highlightStyle).isBoundToList()) {
|
||||
_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;
|
||||
|
@ -126,7 +144,7 @@ QVariantMap SelectionScriptingInterface::getListHighlightStyle(const QString& li
|
|||
|
||||
render::HighlightStyle SelectionScriptingInterface::getHighlightStyle(const QString& listName) const {
|
||||
auto highlightStyle = _highlightedListMap.find(listName);
|
||||
if (highlightStyle != _highlightedListMap.end()) {
|
||||
if (highlightStyle == _highlightedListMap.end()) {
|
||||
return render::HighlightStyle();
|
||||
} else {
|
||||
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) {
|
||||
auto handler = _handlerMap.find(selectionName);
|
||||
if (handler == _handlerMap.end()) {
|
||||
|
@ -223,14 +233,9 @@ void SelectionToSceneHandler::initialize(const QString& listName) {
|
|||
_listName = listName;
|
||||
|
||||
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) {
|
||||
|
@ -284,25 +289,36 @@ void SelectionToSceneHandler::updateSceneFromSelectedList() {
|
|||
qWarning() << "SelectionToSceneHandler::updateRendererSelectedList(), Unexpected null scene, possibly during application shutdown";
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
void SelectionToSceneHandler::highlightStyleChanged(const QString& listName) {
|
||||
if (listName == _listName) {
|
||||
auto mainScene = qApp->getMain3DScene();
|
||||
if (mainScene) {
|
||||
auto thisStyle = DependencyManager::get<SelectionScriptingInterface>()->getHighlightStyle(listName);
|
||||
render::Transaction transaction;
|
||||
render::ItemIDs finalList;
|
||||
|
||||
transaction.resetSelectionHighlight(listName.toStdString(), thisStyle);
|
||||
|
||||
mainScene->enqueueTransaction(transaction);
|
||||
}
|
||||
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) {
|
||||
auto outlineColor = properties["outlineColor"];
|
||||
if (outlineColor.isValid()) {
|
||||
|
|
|
@ -59,7 +59,8 @@ public:
|
|||
|
||||
public slots:
|
||||
void selectedItemsListChanged(const QString& listName);
|
||||
void highlightStyleChanged(const QString& listName);
|
||||
// void highlightStyleChanged(const QString& listName);
|
||||
// void highlightStyleRemoved(const QString& listName);
|
||||
|
||||
private:
|
||||
QString _listName{ "" };
|
||||
|
@ -137,12 +138,10 @@ public:
|
|||
|
||||
render::HighlightStyle getHighlightStyle(const QString& listName) const;
|
||||
|
||||
void onSelectedItemsListChanged(const QString& listName);
|
||||
void onHighlightStyleChanged(const QString& listName);
|
||||
|
||||
signals:
|
||||
void selectedItemsListChanged(const QString& listName);
|
||||
void highlightStyleChanged(const QString& listName);
|
||||
// void highlightStyleChanged(const QString& listName);
|
||||
// void highlightStyleRemoved(const QString& listName);
|
||||
|
||||
private:
|
||||
QMap<QString, GameplayObjects> _selectedItemsListMap;
|
||||
|
@ -154,6 +153,8 @@ private:
|
|||
template <class T> bool removeFromGameplayObjects(const QString& listName, T idToRemove);
|
||||
|
||||
void setupHandler(const QString& selectionName);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // hifi_SelectionScriptingInterface_h
|
||||
|
|
|
@ -70,14 +70,6 @@ ContextOverlayInterface::ContextOverlayInterface() {
|
|||
|
||||
{
|
||||
_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>();
|
||||
|
@ -86,12 +78,6 @@ ContextOverlayInterface::ContextOverlayInterface() {
|
|||
_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 LEFT_HAND_HW_ID = 1;
|
||||
static const xColor CONTEXT_OVERLAY_COLOR = { 255, 255, 255 };
|
||||
|
|
|
@ -96,9 +96,6 @@ private:
|
|||
void disableEntityHighlight(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();
|
||||
QTimer _challengeOwnershipTimeoutTimer;
|
||||
|
|
Loading…
Reference in a new issue