mirror of
https://github.com/lubosz/overte.git
synced 2025-08-07 17:41:12 +02:00
More to come
This commit is contained in:
parent
1efddb8260
commit
5500a6d11c
3 changed files with 80 additions and 24 deletions
|
@ -80,6 +80,20 @@ bool SelectionScriptingInterface::clearSelectedItemsList(const QString& listName
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList SelectionScriptingInterface::getListNames() const {
|
||||||
|
QStringList list;
|
||||||
|
QReadLocker lock(&_selectionListsLock);
|
||||||
|
list = _selectedItemsListMap.keys();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList SelectionScriptingInterface::getHighlightedListNames() const {
|
||||||
|
QStringList list;
|
||||||
|
QReadLocker lock(&_highlightStylesLock);
|
||||||
|
list = _highlightStyleMap.keys();
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
bool SelectionScriptingInterface::enableListHighlight(const QString& listName, const QVariantMap& highlightStyleValues) {
|
bool SelectionScriptingInterface::enableListHighlight(const QString& listName, const QVariantMap& highlightStyleValues) {
|
||||||
QWriteLocker lock(&_highlightStylesLock);
|
QWriteLocker lock(&_highlightStylesLock);
|
||||||
|
|
||||||
|
@ -146,14 +160,6 @@ QVariantMap SelectionScriptingInterface::getListHighlightStyle(const QString& li
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QStringList SelectionScriptingInterface::getHighlightStyles() const {
|
|
||||||
QStringList list;
|
|
||||||
QReadLocker lock(&_highlightStylesLock);
|
|
||||||
list = _highlightStyleMap.keys();
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
render::HighlightStyle SelectionScriptingInterface::getHighlightStyle(const QString& listName) const {
|
render::HighlightStyle SelectionScriptingInterface::getHighlightStyle(const QString& listName) const {
|
||||||
QReadLocker lock(&_highlightStylesLock);
|
QReadLocker lock(&_highlightStylesLock);
|
||||||
auto highlightStyle = _highlightStyleMap.find(listName);
|
auto highlightStyle = _highlightStyleMap.find(listName);
|
||||||
|
@ -234,6 +240,43 @@ void SelectionScriptingInterface::printList(const QString& listName) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariantMap SelectionScriptingInterface::getSelectedItemsList(const QString& listName) const {
|
||||||
|
QReadLocker lock(&_selectionListsLock);
|
||||||
|
QVariantMap list;
|
||||||
|
auto currentList = _selectedItemsListMap.find(listName);
|
||||||
|
if (currentList != _selectedItemsListMap.end()) {
|
||||||
|
if ((*currentList).getContainsData()) {
|
||||||
|
|
||||||
|
if (!(*currentList).getAvatarIDs().empty()) {
|
||||||
|
QList<QUuid> avatarIDs = QList<QUuid>::fromVector(QVector<QUuid>::fromStdVector((*currentList).getAvatarIDs()));
|
||||||
|
list["avatars"].fromValue( avatarIDs);
|
||||||
|
}
|
||||||
|
if (!(*currentList).getEntityIDs().empty()) {
|
||||||
|
// QList<EntityItemID> entityIDs = QList<EntityItemID>::fromVector(QVector<EntityItemID>::fromStdVector((*currentList).getEntityIDs()));
|
||||||
|
QList<QVariant> entityIDs;
|
||||||
|
for (auto j : (*currentList).getEntityIDs()) {
|
||||||
|
entityIDs.push_back( j );
|
||||||
|
}
|
||||||
|
list["entities"] = (entityIDs);
|
||||||
|
}
|
||||||
|
if (!(*currentList).getOverlayIDs().empty()) {
|
||||||
|
QList<OverlayID> overlayIDs = QList<OverlayID>::fromVector(QVector<OverlayID>::fromStdVector((*currentList).getOverlayIDs()));
|
||||||
|
list["overlays"].fromValue(overlayIDs);
|
||||||
|
}
|
||||||
|
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//qDebug() << "List named " << listName << " empty";
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// qDebug() << "List named " << listName << " doesn't exist.";
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool SelectionScriptingInterface::removeListFromMap(const QString& listName) {
|
bool SelectionScriptingInterface::removeListFromMap(const QString& listName) {
|
||||||
bool removed = false;
|
bool removed = false;
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,17 +27,17 @@ class GameplayObjects {
|
||||||
public:
|
public:
|
||||||
GameplayObjects();
|
GameplayObjects();
|
||||||
|
|
||||||
bool getContainsData() { return containsData; }
|
bool getContainsData() const { return containsData; }
|
||||||
|
|
||||||
std::vector<QUuid> getAvatarIDs() { return _avatarIDs; }
|
std::vector<QUuid> getAvatarIDs() const { return _avatarIDs; }
|
||||||
bool addToGameplayObjects(const QUuid& avatarID);
|
bool addToGameplayObjects(const QUuid& avatarID);
|
||||||
bool removeFromGameplayObjects(const QUuid& avatarID);
|
bool removeFromGameplayObjects(const QUuid& avatarID);
|
||||||
|
|
||||||
std::vector<EntityItemID> getEntityIDs() { return _entityIDs; }
|
std::vector<EntityItemID> getEntityIDs() const { return _entityIDs; }
|
||||||
bool addToGameplayObjects(const EntityItemID& entityID);
|
bool addToGameplayObjects(const EntityItemID& entityID);
|
||||||
bool removeFromGameplayObjects(const EntityItemID& entityID);
|
bool removeFromGameplayObjects(const EntityItemID& entityID);
|
||||||
|
|
||||||
std::vector<OverlayID> getOverlayIDs() { return _overlayIDs; }
|
std::vector<OverlayID> getOverlayIDs() const { return _overlayIDs; }
|
||||||
bool addToGameplayObjects(const OverlayID& overlayID);
|
bool addToGameplayObjects(const OverlayID& overlayID);
|
||||||
bool removeFromGameplayObjects(const OverlayID& overlayID);
|
bool removeFromGameplayObjects(const OverlayID& overlayID);
|
||||||
|
|
||||||
|
@ -90,14 +90,8 @@ class SelectionScriptingInterface : public QObject, public Dependency {
|
||||||
public:
|
public:
|
||||||
SelectionScriptingInterface();
|
SelectionScriptingInterface();
|
||||||
|
|
||||||
GameplayObjects getList(const QString& listName);
|
Q_INVOKABLE QStringList getListNames() const;
|
||||||
|
|
||||||
/**jsdoc
|
|
||||||
* Prints out the list of avatars, entities and overlays stored in a particular selection.
|
|
||||||
* @function Selection.printList
|
|
||||||
* @param listName {string} name of the selection
|
|
||||||
*/
|
|
||||||
Q_INVOKABLE void printList(const QString& listName);
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Removes a named selection from the list of selections.
|
* Removes a named selection from the list of selections.
|
||||||
* @function Selection.removeListFromMap
|
* @function Selection.removeListFromMap
|
||||||
|
@ -132,6 +126,26 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE bool clearSelectedItemsList(const QString& listName);
|
Q_INVOKABLE bool clearSelectedItemsList(const QString& listName);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Prints out the list of avatars, entities and overlays stored in a particular selection.
|
||||||
|
* @function Selection.printList
|
||||||
|
* @param listName {string} name of the selection
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE void printList(const QString& listName);
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Query the list of avatars, entities and overlays stored in a particular selection.
|
||||||
|
* @function Selection.getList
|
||||||
|
* @param listName {string} name of the selection
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Q_INVOKABLE QVariantMap getSelectedItemsList(const QString& listName) const;
|
||||||
|
|
||||||
|
//
|
||||||
|
Q_INVOKABLE QStringList getHighlightedListNames() const;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Enable highlighting for the named selection.
|
* Enable highlighting for the named selection.
|
||||||
* If the Selection doesn't exist, it will be created.
|
* If the Selection doesn't exist, it will be created.
|
||||||
|
@ -176,7 +190,8 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE QVariantMap getListHighlightStyle(const QString& listName) const;
|
Q_INVOKABLE QVariantMap getListHighlightStyle(const QString& listName) const;
|
||||||
|
|
||||||
Q_INVOKABLE QStringList getHighlightStyles() const;
|
|
||||||
|
GameplayObjects getList(const QString& listName);
|
||||||
|
|
||||||
render::HighlightStyle getHighlightStyle(const QString& listName) const;
|
render::HighlightStyle getHighlightStyle(const QString& listName) const;
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ Item {
|
||||||
anchors.margins: 0
|
anchors.margins: 0
|
||||||
property var listName: "contextOverlayHighlightList"
|
property var listName: "contextOverlayHighlightList"
|
||||||
|
|
||||||
property var styleList: Selection.getHighlightStyles()
|
property var styleList: Selection.getHighlightedListNames()
|
||||||
|
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
|
|
||||||
|
@ -50,10 +50,9 @@ Item {
|
||||||
id: debug
|
id: debug
|
||||||
text: "Refresh"
|
text: "Refresh"
|
||||||
height: 24
|
height: 24
|
||||||
width: 128
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
print("list of highlight styles")
|
print("list of highlight styles")
|
||||||
root.styleList = Selection.getHighlightStyles()
|
root.styleList = Selection.getHighlightedListNames()
|
||||||
|
|
||||||
print(root.styleList)
|
print(root.styleList)
|
||||||
styleSelectorLoader.sourceComponent = undefined;
|
styleSelectorLoader.sourceComponent = undefined;
|
||||||
|
@ -71,7 +70,6 @@ Item {
|
||||||
id: selectorWidget
|
id: selectorWidget
|
||||||
HifiControls.ComboBox {
|
HifiControls.ComboBox {
|
||||||
id: box
|
id: box
|
||||||
width: 350
|
|
||||||
z: 999
|
z: 999
|
||||||
editable: true
|
editable: true
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
|
|
Loading…
Reference in a new issue