mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 05:58:27 +02:00
Workable state, need final clean up and testing
This commit is contained in:
parent
5f85e8e2cb
commit
6148458aeb
3 changed files with 77 additions and 21 deletions
|
@ -59,8 +59,6 @@ public:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void selectedItemsListChanged(const QString& listName);
|
void selectedItemsListChanged(const QString& listName);
|
||||||
// void highlightStyleChanged(const QString& listName);
|
|
||||||
// void highlightStyleRemoved(const QString& listName);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString _listName{ "" };
|
QString _listName{ "" };
|
||||||
|
@ -90,6 +88,11 @@ class SelectionScriptingInterface : public QObject, public Dependency {
|
||||||
public:
|
public:
|
||||||
SelectionScriptingInterface();
|
SelectionScriptingInterface();
|
||||||
|
|
||||||
|
/**jsdoc
|
||||||
|
* Query the names of all the selection lists
|
||||||
|
* @function Selection.getListNames
|
||||||
|
* @return An array of names of all the selection lists
|
||||||
|
*/
|
||||||
Q_INVOKABLE QStringList getListNames() const;
|
Q_INVOKABLE QStringList getListNames() const;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
@ -126,8 +129,6 @@ public:
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE bool clearSelectedItemsList(const QString& listName);
|
Q_INVOKABLE bool clearSelectedItemsList(const QString& listName);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Prints out the list of avatars, entities and overlays stored in a particular selection.
|
* Prints out the list of avatars, entities and overlays stored in a particular selection.
|
||||||
* @function Selection.printList
|
* @function Selection.printList
|
||||||
|
@ -139,11 +140,18 @@ public:
|
||||||
* Query the list of avatars, entities and overlays stored in a particular selection.
|
* Query the list of avatars, entities and overlays stored in a particular selection.
|
||||||
* @function Selection.getList
|
* @function Selection.getList
|
||||||
* @param listName {string} name of the selection
|
* @param listName {string} name of the selection
|
||||||
* @return
|
* @return a js object containing the following properties (if the array of obkjects are not empty):
|
||||||
|
* - "entities": [ and array of the entityID of the entities in the selection]
|
||||||
|
* - "avatars": [ and array of the avatarID of the avatars in the selection]
|
||||||
|
* - "overlays": [ and array of the overlayID of the overlays in the selection]
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE QVariantMap getSelectedItemsList(const QString& listName) const;
|
Q_INVOKABLE QVariantMap getSelectedItemsList(const QString& listName) const;
|
||||||
|
|
||||||
//
|
/**jsdoc
|
||||||
|
* Query the names of the highlighted selection lists
|
||||||
|
* @function Selection.getHighlightedListNames
|
||||||
|
* @return An array of names of the selection list currently highlight enabled
|
||||||
|
*/
|
||||||
Q_INVOKABLE QStringList getHighlightedListNames() const;
|
Q_INVOKABLE QStringList getHighlightedListNames() const;
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
|
|
|
@ -26,9 +26,9 @@ namespace render {
|
||||||
};
|
};
|
||||||
|
|
||||||
RGBA _outlineUnoccluded{ { 1.f, 0.7f, 0.2f }, 0.9f };
|
RGBA _outlineUnoccluded{ { 1.f, 0.7f, 0.2f }, 0.9f };
|
||||||
RGBA _outlineOccluded{ { 0.2f, 0.7f, 1.0f }, 0.9f };
|
RGBA _outlineOccluded{ { 1.f, 0.7f, 0.2f }, 0.9f };
|
||||||
RGBA _fillUnoccluded{ { 1.f, 0.2f, 0.7f }, 0.0f };
|
RGBA _fillUnoccluded{ { 0.2f, 0.7f, 1.0f }, 0.0f };
|
||||||
RGBA _fillOccluded{ { 0.7f, 1.f, 0.2f }, 0.0f };
|
RGBA _fillOccluded{ { 0.2f, 0.7f, 1.0f }, 0.0f };
|
||||||
|
|
||||||
float _outlineWidth{ 2.0f };
|
float _outlineWidth{ 2.0f };
|
||||||
bool _isOutlineSmooth{ false };
|
bool _isOutlineSmooth{ false };
|
||||||
|
|
|
@ -29,14 +29,18 @@ Item {
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
// Connect the signal from Selection when any selection content change and use it to refresh the current selection view
|
||||||
|
Selection.selectedItemsListChanged.connect(resetSelectionView)
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetSelectionView() {
|
||||||
|
selectionView.resetSelectionView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
id: col
|
id: col
|
||||||
spacing: 5
|
spacing: 5
|
||||||
anchors.left: root.left
|
anchors.fill: root
|
||||||
anchors.right: root.right
|
|
||||||
anchors.margins: hifi.dimensions.contentMargin.x
|
anchors.margins: hifi.dimensions.contentMargin.x
|
||||||
|
|
||||||
Row {
|
Row {
|
||||||
|
@ -50,6 +54,7 @@ Item {
|
||||||
id: debug
|
id: debug
|
||||||
text: "Refresh"
|
text: "Refresh"
|
||||||
height: 24
|
height: 24
|
||||||
|
width: 82
|
||||||
onClicked: {
|
onClicked: {
|
||||||
print("list of highlight styles")
|
print("list of highlight styles")
|
||||||
root.styleList = Selection.getHighlightedListNames()
|
root.styleList = Selection.getHighlightedListNames()
|
||||||
|
@ -57,13 +62,14 @@ Item {
|
||||||
print(root.styleList)
|
print(root.styleList)
|
||||||
styleSelectorLoader.sourceComponent = undefined;
|
styleSelectorLoader.sourceComponent = undefined;
|
||||||
styleSelectorLoader.sourceComponent = selectorWidget;
|
styleSelectorLoader.sourceComponent = selectorWidget;
|
||||||
|
resetSelectionView();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
id: styleSelectorLoader
|
id: styleSelectorLoader
|
||||||
sourceComponent: selectorWidget
|
sourceComponent: selectorWidget
|
||||||
width: 350
|
width: 300
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
}
|
}
|
||||||
Component {
|
Component {
|
||||||
|
@ -79,11 +85,12 @@ Item {
|
||||||
Timer {
|
Timer {
|
||||||
id: postpone
|
id: postpone
|
||||||
interval: 100; running: false; repeat: false
|
interval: 100; running: false; repeat: false
|
||||||
onTriggered: { styleWidgetLoader.sourceComponent = styleWidget }
|
onTriggered: {
|
||||||
|
styleWidgetLoader.sourceComponent = styleWidget
|
||||||
|
}
|
||||||
}
|
}
|
||||||
onCurrentIndexChanged: {
|
onCurrentIndexChanged: {
|
||||||
root.listName = model[currentIndex];
|
root.listName = model[currentIndex];
|
||||||
// sendToScript("highlight "+currentIndex)
|
|
||||||
// This is a hack to be sure the widgets below properly reflect the change of category: delete the Component
|
// This is a hack to be sure the widgets below properly reflect the change of category: delete the Component
|
||||||
// by setting the loader source to Null and then recreate it 100ms later
|
// by setting the loader source to Null and then recreate it 100ms later
|
||||||
styleWidgetLoader.sourceComponent = undefined;
|
styleWidgetLoader.sourceComponent = undefined;
|
||||||
|
@ -91,8 +98,6 @@ Item {
|
||||||
postpone.start()
|
postpone.start()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,9 +106,52 @@ Item {
|
||||||
id: styleWidgetLoader
|
id: styleWidgetLoader
|
||||||
sourceComponent: styleWidget
|
sourceComponent: styleWidget
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
}
|
height: 240
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Separator {}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
id: selectionView
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
height: 250
|
||||||
|
color: hifi.colors.lightGray
|
||||||
|
|
||||||
|
function resetSelectionView() {
|
||||||
|
// myModel.resetSelectionView();
|
||||||
|
var entities = Selection.getSelectedItemsList(root.listName)["entities"]
|
||||||
|
//print("resetSelectionView" + JSON.stringify(entities))
|
||||||
|
myModel.clear()
|
||||||
|
var fLen = entities.length;
|
||||||
|
for (var i = 0; i < fLen; i++) {
|
||||||
|
myModel.append({ "objectID": JSON.stringify(entities[i]) })
|
||||||
|
// print("resetSelectionView" + JSON.stringify( entities[i]))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListModel {
|
||||||
|
id: myModel
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: myDelegate
|
||||||
|
Row {
|
||||||
|
id: fruit
|
||||||
|
Text { text: JSON.stringify(objectID) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: selectionListView
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.topMargin: 30
|
||||||
|
model: myModel
|
||||||
|
delegate: myDelegate
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Component {
|
Component {
|
||||||
id: styleWidget
|
id: styleWidget
|
||||||
|
@ -116,7 +164,7 @@ Item {
|
||||||
|
|
||||||
onNewStyle: {
|
onNewStyle: {
|
||||||
var style = getStyle()
|
var style = getStyle()
|
||||||
// print("new style " + JSON.stringify(style) )
|
// print("new style " + JSON.stringify(style) )
|
||||||
Selection.enableListHighlight(root.listName, style)
|
Selection.enableListHighlight(root.listName, style)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue