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 @@
1//1//
2// XColor.qml2// Color.qml
3//3//
4// Created by Sam Gateau 12/4/20174// Created by Sam Gateau 12/4/2017
5// Copyright 2017 High Fidelity, Inc.5// Copyright 2017 High Fidelity, Inc.
@@ -20,48 +20,57 @@ Item { · 14 unmodified lines
20 HifiConstants { id: hifi }20 HifiConstants { id: hifi }
21 id: root21 id: root
22 22
23 anchors.left: parent.left
24 anchors.right: parent.right
25 height: 2423 height: 24
26 property var color24
25 property var _color: Qt.rgba(1.0, 1.0, 1.0, 1.0 );
27 property var zoneWidth: width / 3;26 property var zoneWidth: width / 3;
28 property var hoveredOn: 0.0;27 property var hoveredOn: 0.0;
29 property var sliderHeight: height / 3;28 property var sliderHeight: height / 2;
30 29
31 signal newColor( color la_color)30 signal newColor(color __color)
32 function getColor() {
33 return Qt.rgba(color.red / 255.0, color.green / 255.0, color.blue / 255.0, 1.0 );
34 }
35 31
36 function repaint() {32 function setColor(color) {
37 current.color = getColor()33 _color = Qt.rgba(color.r, color.g, color.b, 1.0)
38 }34 updateColor()
35 }
39 function setRed(r) {36 function setRed(r) {
40 color.red = r * 255;37 _color.r = r;
41 repaint()38 updateColor()
42 print("set red " + r)
43 }39 }
44 function setGreen(g) {40 function setGreen(g) {
45 color.green = g * 255;41 _color.g = g;
46 repaint()42 updateColor()
47 print("set green " + g)
48 }43 }
49 function setBlue(b) {44 function setBlue(b) {
50 color.blue = b * 255;45 _color.b = b;
46 updateColor()
47 }
48
49 function updateColor() {
51 repaint()50 repaint()
52 print("set blue " + b)51 newColor(_color)
52 }
53 function repaint() {
54 current.color = _color
53 }55 }
54 56
55 function resetSliders() {57 function resetSliders() {
56 redZone.set(color.red / 255) 58 redZone.set(_color.r)
57 greenZone.set(color.green / 255) 59 greenZone.set(_color.g)
58 blueZone.set(color.blue / 255) 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}
59 }68 }
60 69
61 Rectangle {70 Rectangle {
62 id: current71 id: current
63 anchors.fill: root72 anchors.fill: root
64 color: root.getColor();73 color: root._color;
65 }74 }
66 Rectangle {75 Rectangle {
67 id: sliderBack76 id: sliderBack
@@ -87,8 +96,6 @@ Item { · 19 unmodified lines
87 } 96 }
88 97
89 Component.onCompleted: {98 Component.onCompleted: {
90 // Binding favors qml value, so set it first
91 bindingControl.when = true;
92 }99 }
93 100
94 Item {101 Item {
@@ -98,13 +105,16 @@ Item { · 3 unmodified lines
98 anchors.left: root.left105 anchors.left: root.left
99 width: root.zoneWidth 106 width: root.zoneWidth
100 107
101 function set(r) {108 function update(r) {
102 if (r < 0.0) {109 if (r < 0.0) {
103 r = 0.0110 r = 0.0
104 } else if (r > 1.0) {111 } else if (r > 1.0) {
105 r = 1.0112 r = 1.0
106 }113 }
107 root.setRed(r)114 root.setRed(r)
115 set(r)
116 }
117 function set(r) {
108 redRect.width = r * redZone.width118 redRect.width = r * redZone.width
109 redRect.color = Qt.rgba(r, 0, 0, 1) 119 redRect.color = Qt.rgba(r, 0, 0, 1)
110 }120 }
@@ -121,7 +131,7 @@ Item { · 10 unmodified lines
121 id: redArea131 id: redArea
122 anchors.fill: parent132 anchors.fill: parent
123 onPositionChanged: {133 onPositionChanged: {
124 redZone.set(mouse.x / redArea.width)134 redZone.update(mouse.x / redArea.width)
125 } 135 }
126 }136 }
127 }137 }
@@ -129,17 +139,19 @@ Item { · 1 unmodified line
129 id: greenZone139 id: greenZone
130 anchors.top: root.top140 anchors.top: root.top
131 anchors.bottom: root.bottom141 anchors.bottom: root.bottom
132 anchors.left: redZone.right142 anchors.horizontalCenter: root.horizontalCenter
133
134 width: root.zoneWidth 143 width: root.zoneWidth
135 144
136 function set(g) {145 function update(g) {
137 if (g < 0.0) {146 if (g < 0.0) {
138 g = 0.0147 g = 0.0
139 } else if (g > 1.0) {148 } else if (g > 1.0) {
140 g = 1.0149 g = 1.0
141 }150 }
142 root.setGreen(g)151 root.setGreen(g)
152 set(g)
153 }
154 function set(g) {
143 greenRect.width = g * greenZone.width155 greenRect.width = g * greenZone.width
144 greenRect.color = Qt.rgba(0, g, 0, 1) 156 greenRect.color = Qt.rgba(0, g, 0, 1)
145 }157 }
@@ -156,7 +168,7 @@ Item { · 10 unmodified lines
156 id: greenArea168 id: greenArea
157 anchors.fill: parent169 anchors.fill: parent
158 onPositionChanged: {170 onPositionChanged: {
159 greenZone.set(mouse.x / greenArea.width)171 greenZone.update(mouse.x / greenArea.width)
160 } 172 }
161 }173 }
162 }174 }
@@ -164,18 +176,19 @@ Item { · 1 unmodified line
164 id: blueZone176 id: blueZone
165 anchors.top: root.top177 anchors.top: root.top
166 anchors.bottom: root.bottom178 anchors.bottom: root.bottom
167 anchors.right: root.right179 anchors.right: root.right
168 // anchors.left: greenZone.right
169
170 width: root.zoneWidth 180 width: root.zoneWidth
171 181
172 function set(b) {182 function update(b) {
173 if (b < 0.0) {183 if (b < 0.0) {
174 b = 0.0184 b = 0.0
175 } else if (b > 1.0) {185 } else if (b > 1.0) {
176 b = 1.0186 b = 1.0
177 }187 }
178 root.setBlue(b)188 root.setBlue(b)
189 set(b)
190 }
191 function set(b) {
179 blueRect.width = b * blueZone.width192 blueRect.width = b * blueZone.width
180 blueRect.color = Qt.rgba(0, 0, b, 1) 193 blueRect.color = Qt.rgba(0, 0, b, 1)
181 }194 }
@@ -192,7 +205,7 @@ Item { · 10 unmodified lines
192 id: blueArea205 id: blueArea
193 anchors.fill: parent206 anchors.fill: parent
194 onPositionChanged: {207 onPositionChanged: {
195 blueZone.set(mouse.x / blueArea.width)208 blueZone.update(mouse.x / blueArea.width)
196 }209 }
197 }210 }
198 } 211 }
scripts/developer/utilities/lib/plotperf/qmldir+1−1
@@ -1,2 +1,2 @@
1PlotPerf 1.0 PlotPerf.qml1PlotPerf 1.0 PlotPerf.qml
2XColor 1.0 XColor.qml2Color 1.0 Color.qml
scripts/developer/utilities/render/configSlider/ConfigSlider.qml+4−0
@@ -30,6 +30,8 @@ Item { · 29 unmodified lines
30 property alias min: sliderControl.minimumValue30 property alias min: sliderControl.minimumValue
31 property alias max: sliderControl.maximumValue31 property alias max: sliderControl.maximumValue
32 32
33 signal valueChanged(real value)
34
33 Component.onCompleted: {35 Component.onCompleted: {
34 // Binding favors qml value, so set it first36 // Binding favors qml value, so set it first
35 sliderControl.value = root.config[root.property];37 sliderControl.value = root.config[root.property];
@@ -69,5 +71,7 @@ Item { · 33 unmodified lines
69 anchors.rightMargin: 071 anchors.rightMargin: 0
70 anchors.top: root.top72 anchors.top: root.top
71 anchors.topMargin: 073 anchors.topMargin: 0
74
75 onValueChanged: { root.valueChanged(value) }
72 }76 }
73}77}
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//
10import QtQuick 2.7
11import QtQuick.Controls 1.4
12import QtQuick.Layouts 1.3
13import "../configSlider"
14import "../../lib/plotperf"
15import "qrc:///qml/styles-uit"
16import "qrc:///qml/controls-uit" as HifiControls
17
18Item {
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 @@
1HighlightStyle 1.0 HighlightStyle.qml
scripts/developer/utilities/render/highlight2.qml+84−130
@@ -16,157 +16,111 @@ import "qrc:///qml/styles-uit" · 15 unmodified lines
16import "qrc:///qml/controls-uit" as HifiControls16import "qrc:///qml/controls-uit" as HifiControls
17import "configSlider"17import "configSlider"
18import "../lib/plotperf"18import "../lib/plotperf"
19import "highlight"
19 20
20Rectangle {21Item {
21 id: root22 id: root
22 HifiConstants { id: hifi;}23 HifiConstants { id: hifi;}
23 color: hifi.colors.baseGray;24 anchors.margins: 0
24 anchors.margins: hifi.dimensions.contentMargin.x25 property var listName: "contextOverlayHighlightList"
26
27 property var styleList: Selection.getHighlightStyles()
25 28
26
27 signal sendToScript(var message);29 signal sendToScript(var message);
28 30
31 Component.onCompleted: {
32 }
33
34
29 Column {35 Column {
30 id: col36 id: col
31 spacing: 1037 spacing: 5
32 anchors.left: parent.left38 anchors.left: root.left
33 anchors.right: parent.right 39 anchors.right: root.right
34 anchors.margins: hifi.dimensions.contentMargin.x 40 anchors.margins: hifi.dimensions.contentMargin.x
35 41
36 Separator {}42 Row {
37 Row {43 id: controlbar
38 height: 2444 spacing: 10
39 anchors.left: parent.left45 anchors.left: parent.left
40 anchors.right: parent.right 46 anchors.right: parent.right
41 HifiControls.Label {47 height: 24
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 }
89 48
90 Loader {49 HifiControls.Button {
91 id: paramWidgetLoader50 id: debug
92 sourceComponent: paramWidgets51 text: "Refresh"
93 width: 35052 height: 24
94 }53 width: 128
54 onClicked: {
55 print("list of highlight styles")
56 root.styleList = Selection.getHighlightStyles()
95 57
96 Component {58 print(root.styleList)
97 id: paramWidgets59 styleSelectorLoader.sourceComponent = undefined;
60 styleSelectorLoader.sourceComponent = selectorWidget;
61 }
62 }
98 63
99 Column {64 Loader {
100 spacing: 1065 id: styleSelectorLoader
101 anchors.margins: hifi.dimensions.contentMargin.x 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: ""
102 80
103 HifiControls.Label {81 Timer {
104 text: "Outline" 82 id: postpone
105 }83 interval: 100; running: false; repeat: false
106 Column {84 onTriggered: { styleWidgetLoader.sourceComponent = styleWidget }
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 }
116 }85 }
117 Repeater {86 onCurrentIndexChanged: {
118 model: ["Width:outlineWidth:5.0:0.0",87 root.listName = model[currentIndex];
119 "Intensity:outlineIntensity:1.0:0.0"88 // sendToScript("highlight "+currentIndex)
120 ]89 // This is a hack to be sure the widgets below properly reflect the change of category: delete the Component
121 ConfigSlider {90 // by setting the loader source to Null and then recreate it 100ms later
122 label: qsTr(modelData.split(":")[0])91 styleWidgetLoader.sourceComponent = undefined;
123 integral: false92 postpone.interval = 100
124 config: root.highlightConfig93 postpone.start()
125 property: modelData.split(":")[1]
126 max: modelData.split(":")[2]
127 min: modelData.split(":")[3]
128 }
129 }94 }
130 }95 }
131 96
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 }
150 97
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 }
168 }98 }
169 }99 }
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 }
171 }125 }
172}126}