mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01: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:
|
||||
void selectedItemsListChanged(const QString& listName);
|
||||
// void highlightStyleChanged(const QString& listName);
|
||||
// void highlightStyleRemoved(const QString& listName);
|
||||
|
||||
private:
|
||||
QString _listName{ "" };
|
||||
|
@ -90,6 +88,11 @@ class SelectionScriptingInterface : public QObject, public Dependency {
|
|||
public:
|
||||
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;
|
||||
|
||||
/**jsdoc
|
||||
|
@ -126,8 +129,6 @@ public:
|
|||
*/
|
||||
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
|
||||
|
@ -139,11 +140,18 @@ public:
|
|||
* Query the list of avatars, entities and overlays stored in a particular selection.
|
||||
* @function Selection.getList
|
||||
* @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;
|
||||
|
||||
//
|
||||
/**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;
|
||||
|
||||
/**jsdoc
|
||||
|
|
|
@ -26,9 +26,9 @@ namespace render {
|
|||
};
|
||||
|
||||
RGBA _outlineUnoccluded{ { 1.f, 0.7f, 0.2f }, 0.9f };
|
||||
RGBA _outlineOccluded{ { 0.2f, 0.7f, 1.0f }, 0.9f };
|
||||
RGBA _fillUnoccluded{ { 1.f, 0.2f, 0.7f }, 0.0f };
|
||||
RGBA _fillOccluded{ { 0.7f, 1.f, 0.2f }, 0.0f };
|
||||
RGBA _outlineOccluded{ { 1.f, 0.7f, 0.2f }, 0.9f };
|
||||
RGBA _fillUnoccluded{ { 0.2f, 0.7f, 1.0f }, 0.0f };
|
||||
RGBA _fillOccluded{ { 0.2f, 0.7f, 1.0f }, 0.0f };
|
||||
|
||||
float _outlineWidth{ 2.0f };
|
||||
bool _isOutlineSmooth{ false };
|
||||
|
|
|
@ -29,14 +29,18 @@ Item {
|
|||
signal sendToScript(var message);
|
||||
|
||||
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 {
|
||||
id: col
|
||||
spacing: 5
|
||||
anchors.left: root.left
|
||||
anchors.right: root.right
|
||||
anchors.fill: root
|
||||
anchors.margins: hifi.dimensions.contentMargin.x
|
||||
|
||||
Row {
|
||||
|
@ -50,6 +54,7 @@ Item {
|
|||
id: debug
|
||||
text: "Refresh"
|
||||
height: 24
|
||||
width: 82
|
||||
onClicked: {
|
||||
print("list of highlight styles")
|
||||
root.styleList = Selection.getHighlightedListNames()
|
||||
|
@ -57,13 +62,14 @@ Item {
|
|||
print(root.styleList)
|
||||
styleSelectorLoader.sourceComponent = undefined;
|
||||
styleSelectorLoader.sourceComponent = selectorWidget;
|
||||
resetSelectionView();
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: styleSelectorLoader
|
||||
sourceComponent: selectorWidget
|
||||
width: 350
|
||||
width: 300
|
||||
anchors.right: parent.right
|
||||
}
|
||||
Component {
|
||||
|
@ -79,11 +85,12 @@ Item {
|
|||
Timer {
|
||||
id: postpone
|
||||
interval: 100; running: false; repeat: false
|
||||
onTriggered: { styleWidgetLoader.sourceComponent = styleWidget }
|
||||
onTriggered: {
|
||||
styleWidgetLoader.sourceComponent = styleWidget
|
||||
}
|
||||
}
|
||||
onCurrentIndexChanged: {
|
||||
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
|
||||
// by setting the loader source to Null and then recreate it 100ms later
|
||||
styleWidgetLoader.sourceComponent = undefined;
|
||||
|
@ -91,8 +98,6 @@ Item {
|
|||
postpone.start()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,9 +106,52 @@ Item {
|
|||
id: styleWidgetLoader
|
||||
sourceComponent: styleWidget
|
||||
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 {
|
||||
id: styleWidget
|
||||
|
@ -116,7 +164,7 @@ Item {
|
|||
|
||||
onNewStyle: {
|
||||
var style = getStyle()
|
||||
// print("new style " + JSON.stringify(style) )
|
||||
// print("new style " + JSON.stringify(style) )
|
||||
Selection.enableListHighlight(root.listName, style)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue