History

almost complete setup working, yeah

samcake committed 8 years ago

Commit 14831951 parent 1c5548b8 files · +255 −168Browse files

Showing the changes to scripts/developer (6 of 8 files). Show all

Unified · Split

6 files
  1. scripts/developer/utilities/lib/plotperf/Color.qml +50 −37
  2. scripts/developer/utilities/lib/plotperf/qmldir +1 −1
  3. scripts/developer/utilities/render/configSlider/ConfigSlider.qml +4 −0
  4. scripts/developer/utilities/render/highlight/HighlightStyle.qml +105 −0
  5. scripts/developer/utilities/render/highlight/qmldir +1 −0
  6. scripts/developer/utilities/render/highlight2.qml +84 −130
scripts/developer/utilities/lib/plotperf/Color.qmlrenamed from scripts/developer/utilities/lib/plotperf/XColor.qml+50−37
@@ -1,5 +1,5 @@
11 //
2−// XColor.qml
2+// Color.qml
33 //
44 // Created by Sam Gateau 12/4/2017
55 // Copyright 2017 High Fidelity, Inc.
@@ -20,48 +20,57 @@ Item { · 14 unmodified lines
2020 HifiConstants { id: hifi }
2121 id: root
2222
23− anchors.left: parent.left
24− anchors.right: parent.right
2523 height: 24
26− property var color
24+
25+ property var _color: Qt.rgba(1.0, 1.0, 1.0, 1.0 );
2726 property var zoneWidth: width / 3;
2827 property var hoveredOn: 0.0;
29− property var sliderHeight: height / 3;
28+ property var sliderHeight: height / 2;
3029
31− signal newColor( color la_color)
32− function getColor() {
33− return Qt.rgba(color.red / 255.0, color.green / 255.0, color.blue / 255.0, 1.0 );
34− }
30+ signal newColor(color __color)
3531
36− function repaint() {
37− current.color = getColor()
38− }
32+ function setColor(color) {
33+ _color = Qt.rgba(color.r, color.g, color.b, 1.0)
34+ updateColor()
35+ }
3936 function setRed(r) {
40− color.red = r * 255;
41− repaint()
42− print("set red " + r)
37+ _color.r = r;
38+ updateColor()
4339 }
4440 function setGreen(g) {
45− color.green = g * 255;
46− repaint()
47− print("set green " + g)
41+ _color.g = g;
42+ updateColor()
4843 }
4944 function setBlue(b) {
50− color.blue = b * 255;
45+ _color.b = b;
46+ updateColor()
47+ }
48+
49+ function updateColor() {
5150 repaint()
52− print("set blue " + b)
51+ newColor(_color)
52+ }
53+ function repaint() {
54+ current.color = _color
5355 }
5456
5557 function resetSliders() {
56− redZone.set(color.red / 255)
57− greenZone.set(color.green / 255)
58− blueZone.set(color.blue / 255)
58+ redZone.set(_color.r)
59+ greenZone.set(_color.g)
60+ blueZone.set(_color.b)
61+ }
62+
63+ function setXColor(xcolor) {
64+ setColor(Qt.rgba(xcolor.red/255, xcolor.green/255, color.blue/255, 1.0))
65+ }
66+ function getXColor() {
67+ return {red:_color.r * 255, green:_color.g * 255, blue:_color.b * 255}
5968 }
6069
6170 Rectangle {
6271 id: current
6372 anchors.fill: root
64− color: root.getColor();
73+ color: root._color;
6574 }
6675 Rectangle {
6776 id: sliderBack
@@ -87,8 +96,6 @@ Item { · 19 unmodified lines
8796 }
8897
8998 Component.onCompleted: {
90− // Binding favors qml value, so set it first
91− bindingControl.when = true;
9299 }
93100
94101 Item {
@@ -98,13 +105,16 @@ Item { · 3 unmodified lines
98105 anchors.left: root.left
99106 width: root.zoneWidth
100107
101− function set(r) {
108+ function update(r) {
102109 if (r < 0.0) {
103110 r = 0.0
104111 } else if (r > 1.0) {
105112 r = 1.0
106113 }
107114 root.setRed(r)
115+ set(r)
116+ }
117+ function set(r) {
108118 redRect.width = r * redZone.width
109119 redRect.color = Qt.rgba(r, 0, 0, 1)
110120 }
@@ -121,7 +131,7 @@ Item { · 10 unmodified lines
121131 id: redArea
122132 anchors.fill: parent
123133 onPositionChanged: {
124− redZone.set(mouse.x / redArea.width)
134+ redZone.update(mouse.x / redArea.width)
125135 }
126136 }
127137 }
@@ -129,17 +139,19 @@ Item { · 1 unmodified line
129139 id: greenZone
130140 anchors.top: root.top
131141 anchors.bottom: root.bottom
132− anchors.left: redZone.right
133−
142+ anchors.horizontalCenter: root.horizontalCenter
134143 width: root.zoneWidth
135144
136− function set(g) {
145+ function update(g) {
137146 if (g < 0.0) {
138147 g = 0.0
139148 } else if (g > 1.0) {
140149 g = 1.0
141150 }
142151 root.setGreen(g)
152+ set(g)
153+ }
154+ function set(g) {
143155 greenRect.width = g * greenZone.width
144156 greenRect.color = Qt.rgba(0, g, 0, 1)
145157 }
@@ -156,7 +168,7 @@ Item { · 10 unmodified lines
156168 id: greenArea
157169 anchors.fill: parent
158170 onPositionChanged: {
159− greenZone.set(mouse.x / greenArea.width)
171+ greenZone.update(mouse.x / greenArea.width)
160172 }
161173 }
162174 }
@@ -164,18 +176,19 @@ Item { · 1 unmodified line
164176 id: blueZone
165177 anchors.top: root.top
166178 anchors.bottom: root.bottom
167− anchors.right: root.right
168− // anchors.left: greenZone.right
169−
179+ anchors.right: root.right
170180 width: root.zoneWidth
171181
172− function set(b) {
182+ function update(b) {
173183 if (b < 0.0) {
174184 b = 0.0
175185 } else if (b > 1.0) {
176186 b = 1.0
177187 }
178188 root.setBlue(b)
189+ set(b)
190+ }
191+ function set(b) {
179192 blueRect.width = b * blueZone.width
180193 blueRect.color = Qt.rgba(0, 0, b, 1)
181194 }
@@ -192,7 +205,7 @@ Item { · 10 unmodified lines
192205 id: blueArea
193206 anchors.fill: parent
194207 onPositionChanged: {
195− blueZone.set(mouse.x / blueArea.width)
208+ blueZone.update(mouse.x / blueArea.width)
196209 }
197210 }
198211 }
scripts/developer/utilities/lib/plotperf/qmldir+1−1
@@ -1,2 +1,2 @@
11 PlotPerf 1.0 PlotPerf.qml
2−XColor 1.0 XColor.qml
2+Color 1.0 Color.qml
scripts/developer/utilities/render/configSlider/ConfigSlider.qml+4−0
@@ -30,6 +30,8 @@ Item { · 29 unmodified lines
3030 property alias min: sliderControl.minimumValue
3131 property alias max: sliderControl.maximumValue
3232
33+ signal valueChanged(real value)
34+
3335 Component.onCompleted: {
3436 // Binding favors qml value, so set it first
3537 sliderControl.value = root.config[root.property];
@@ -69,5 +71,7 @@ Item { · 33 unmodified lines
6971 anchors.rightMargin: 0
7072 anchors.top: root.top
7173 anchors.topMargin: 0
74+
75+ onValueChanged: { root.valueChanged(value) }
7276 }
7377 }
scripts/developer/utilities/render/highlight/HighlightStyle.qml+105−0
@@ -0,0 +1,105 @@
1+//
2+// highlightStyle.qml
3+//
4+// Created by Sam Gateau 12/4/2017
5+// Copyright 2017 High Fidelity, Inc.
6+//
7+// Distributed under the Apache License, Version 2.0.
8+// See the accompanying file LICENSE or https://www.apache.org/licenses/LICENSE-2.0.html
9+//
10+import QtQuick 2.7
11+import QtQuick.Controls 1.4
12+import QtQuick.Layouts 1.3
13+import "../configSlider"
14+import "../../lib/plotperf"
15+import "qrc:///qml/styles-uit"
16+import "qrc:///qml/controls-uit" as HifiControls
17+
18+Item {
19+ id: root
20+ property var highlightStyle
21+ height: 48
22+
23+ anchors.margins: 0
24+
25+ signal newStyle()
26+
27+ function getStyle() {
28+ return highlightStyle;
29+ }
30+
31+ Component.onCompleted: {
32+ }
33+
34+ Column {
35+ spacing: 5
36+ anchors.left: root.left
37+ anchors.right: root.right
38+ anchors.margins: 0
39+
40+
41+
42+ ConfigSlider {
43+ label: "Outline Width"
44+ integral: false
45+ config: root.highlightStyle
46+ property: "outlineWidth"
47+ max: 10
48+ min: 0
49+
50+ anchors.left: parent.left
51+ anchors.right: parent.right
52+
53+ onValueChanged: { root.highlightStyle["outlineWidth"] = value; newStyle() }
54+ }
55+ HifiControls.CheckBox {
56+ id: isOutlineSmooth
57+ text: "Smooth Outline"
58+ checked: root.highlightStyle["isOutlineSmooth"]
59+ onCheckedChanged: {
60+ root.highlightStyle["isOutlineSmooth"] = checked;
61+ newStyle();
62+ }
63+ }
64+
65+ Repeater {
66+ model: [
67+ "Outline Unoccluded:outlineUnoccludedColor:outlineUnoccludedIntensity",
68+ "Outline Occluded:outlineOccludedColor:outlineOccludedIntensity",
69+ "Fill Unoccluded:fillUnoccludedColor:fillUnoccludedIntensity",
70+ "Fill Occluded:fillOccludedColor:fillOccludedIntensity"]
71+ Column {
72+ anchors.left: parent.left
73+ anchors.right: parent.right
74+ anchors.margins: 0
75+
76+ Color {
77+ height: 20
78+ anchors.right: parent.right
79+ width: root.width / 2
80+ _color: Qt.rgba(root.highlightStyle[modelData.split(":")[1]].red / 255, root.highlightStyle[modelData.split(":")[1]].green / 255, root.highlightStyle[modelData.split(":")[1]].blue / 255, 1.0)
81+ onNewColor: {
82+ root.highlightStyle[modelData.split(":")[1]] = getXColor()
83+ newStyle()
84+ }
85+ }
86+
87+ ConfigSlider {
88+ label: qsTr(modelData.split(":")[0])
89+ integral: false
90+ config: root.highlightStyle
91+ property: modelData.split(":")[2]
92+ max: 1.0
93+ min: 0.0
94+
95+ anchors.left: parent.left
96+ anchors.right: parent.right
97+
98+ onValueChanged: { root.highlightStyle[modelData.split(":")[2]] = value; newStyle() }
99+ }
100+
101+ }
102+ }
103+
104+ }
105+}
scripts/developer/utilities/render/highlight/qmldir+1−0
@@ -0,0 +1 @@
1+HighlightStyle 1.0 HighlightStyle.qml
scripts/developer/utilities/render/highlight2.qml+84−130
@@ -16,157 +16,111 @@ import "qrc:///qml/styles-uit" · 15 unmodified lines
1616 import "qrc:///qml/controls-uit" as HifiControls
1717 import "configSlider"
1818 import "../lib/plotperf"
19+import "highlight"
1920
20−Rectangle {
21+Item {
2122 id: root
2223 HifiConstants { id: hifi;}
23− color: hifi.colors.baseGray;
24− anchors.margins: hifi.dimensions.contentMargin.x
24+ anchors.margins: 0
25+ property var listName: "contextOverlayHighlightList"
26+
27+ property var styleList: Selection.getHighlightStyles()
2528
26−
2729 signal sendToScript(var message);
2830
31+ Component.onCompleted: {
32+ }
33+
34+
2935 Column {
3036 id: col
31− spacing: 10
32− anchors.left: parent.left
33− anchors.right: parent.right
37+ spacing: 5
38+ anchors.left: root.left
39+ anchors.right: root.right
3440 anchors.margins: hifi.dimensions.contentMargin.x
3541
36− Separator {}
37− Row {
38− height: 24
42+ Row {
43+ id: controlbar
44+ spacing: 10
3945 anchors.left: parent.left
40− anchors.right: parent.right
41− HifiControls.Label {
42− height: 24
43− width: parent.width / 2
44− id: labelControl
45− text: "Color"
46− enabled: true
47− anchors.left: parent.left
48− anchors.right: parent.horizontalCenter
49− }
50− XColor {
51− // width: parent.width / 2
52− anchors.left: parent.horizontalCenter
53− anchors.right: parent.right
54− color: { "red": 0, "green": 255, "blue": 0}
55− }
56− }
57− Separator {}
58−
59−/*
60− HifiControls.ComboBox {
61− id: box
62− width: 350
63− z: 999
64− editable: true
65− colorScheme: hifi.colorSchemes.dark
66− model: [
67− "contextOverlayHighlightList",
68− "highlightList1",
69− "highlightList2",
70− "highlightList3",
71− "highlightList4"]
72− label: ""
73−
74− Timer {
75− id: postpone
76− interval: 100; running: false; repeat: false
77− onTriggered: { paramWidgetLoader.sourceComponent = paramWidgets }
78− }
79− onCurrentIndexChanged: {
80− root.highlightConfig["selectionName"] = model[currentIndex];
81− sendToScript("highlight "+currentIndex)
82− // This is a hack to be sure the widgets below properly reflect the change of category: delete the Component
83− // by setting the loader source to Null and then recreate it 100ms later
84− paramWidgetLoader.sourceComponent = undefined;
85− postpone.interval = 100
86− postpone.start()
87− }
88− }
46+ anchors.right: parent.right
47+ height: 24
8948
90− Loader {
91− id: paramWidgetLoader
92− sourceComponent: paramWidgets
93− width: 350
94− }
49+ HifiControls.Button {
50+ id: debug
51+ text: "Refresh"
52+ height: 24
53+ width: 128
54+ onClicked: {
55+ print("list of highlight styles")
56+ root.styleList = Selection.getHighlightStyles()
9557
96− Component {
97− id: paramWidgets
58+ print(root.styleList)
59+ styleSelectorLoader.sourceComponent = undefined;
60+ styleSelectorLoader.sourceComponent = selectorWidget;
61+ }
62+ }
9863
99− Column {
100− spacing: 10
101− anchors.margins: hifi.dimensions.contentMargin.x
64+ Loader {
65+ id: styleSelectorLoader
66+ sourceComponent: selectorWidget
67+ width: 350
68+ anchors.right: parent.right
69+ }
70+ Component {
71+ id: selectorWidget
72+ HifiControls.ComboBox {
73+ id: box
74+ width: 350
75+ z: 999
76+ editable: true
77+ colorScheme: hifi.colorSchemes.dark
78+ model: root.styleList
79+ label: ""
10280
103− HifiControls.Label {
104− text: "Outline"
105− }
106− Column {
107− spacing: 10
108− anchors.left: parent.left
109− anchors.right: parent.right
110− HifiControls.CheckBox {
111− text: "Smooth"
112− checked: root.highlightConfig["isOutlineSmooth"]
113− onCheckedChanged: {
114− root.highlightConfig["isOutlineSmooth"] = checked;
115− }
81+ Timer {
82+ id: postpone
83+ interval: 100; running: false; repeat: false
84+ onTriggered: { styleWidgetLoader.sourceComponent = styleWidget }
11685 }
117− Repeater {
118− model: ["Width:outlineWidth:5.0:0.0",
119− "Intensity:outlineIntensity:1.0:0.0"
120− ]
121− ConfigSlider {
122− label: qsTr(modelData.split(":")[0])
123− integral: false
124− config: root.highlightConfig
125− property: modelData.split(":")[1]
126− max: modelData.split(":")[2]
127− min: modelData.split(":")[3]
128− }
86+ onCurrentIndexChanged: {
87+ root.listName = model[currentIndex];
88+ // sendToScript("highlight "+currentIndex)
89+ // This is a hack to be sure the widgets below properly reflect the change of category: delete the Component
90+ // by setting the loader source to Null and then recreate it 100ms later
91+ styleWidgetLoader.sourceComponent = undefined;
92+ postpone.interval = 100
93+ postpone.start()
12994 }
13095 }
13196
132− Separator {}
133− HifiControls.Label {
134− text: "Color"
135− }
136− Repeater {
137− model: ["Red:colorR:1.0:0.0",
138− "Green:colorG:1.0:0.0",
139− "Blue:colorB:1.0:0.0"
140− ]
141− ConfigSlider {
142− label: qsTr(modelData.split(":")[0])
143− integral: false
144− config: root.highlightConfig
145− property: modelData.split(":")[1]
146− max: modelData.split(":")[2]
147− min: modelData.split(":")[3]
148− }
149− }
15097
151− Separator {}
152− HifiControls.Label {
153− text: "Fill Opacity"
154− }
155− Repeater {
156− model: ["Unoccluded:unoccludedFillOpacity:1.0:0.0",
157− "Occluded:occludedFillOpacity:1.0:0.0"
158− ]
159− ConfigSlider {
160− label: qsTr(modelData.split(":")[0])
161− integral: false
162− config: root.highlightConfig
163− property: modelData.split(":")[1]
164− max: modelData.split(":")[2]
165− min: modelData.split(":")[3]
166− }
167− }
16898 }
16999 }
170− */
100+
101+ Separator {}
102+ Loader {
103+ id: styleWidgetLoader
104+ sourceComponent: styleWidget
105+ anchors.left: parent.left
106+ anchors.right: parent.right
107+ }
108+ }
109+
110+ Component {
111+ id: styleWidget
112+
113+ HighlightStyle {
114+ id: highlightStyle
115+ anchors.left: parent.left
116+ anchors.right: parent.right
117+ highlightStyle: Selection.getListHighlightStyle(root.listName)
118+
119+ onNewStyle: {
120+ var style = getStyle()
121+ // print("new style " + JSON.stringify(style) )
122+ Selection.enableListHighlight(root.listName, style)
123+ }
124+ }
171125 }
172126 }