mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-09 17:38:34 +02:00
Tidy command and callback handling
This commit is contained in:
parent
e6456ca501
commit
bff3ad342d
1 changed files with 61 additions and 31 deletions
|
@ -134,7 +134,9 @@ ToolMenu = function (side, leftInputs, rightInputs, doCallback) {
|
||||||
},
|
},
|
||||||
label: " GROUP",
|
label: " GROUP",
|
||||||
enabledColor: { red: 64, green: 240, blue: 64 },
|
enabledColor: { red: 64, green: 240, blue: 64 },
|
||||||
callback: "groupButton"
|
callback: {
|
||||||
|
method: "groupButton"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "ungroupButton",
|
id: "ungroupButton",
|
||||||
|
@ -146,7 +148,9 @@ ToolMenu = function (side, leftInputs, rightInputs, doCallback) {
|
||||||
},
|
},
|
||||||
label: "UNGROUP",
|
label: "UNGROUP",
|
||||||
enabledColor: { red: 240, green: 64, blue: 64 },
|
enabledColor: { red: 240, green: 64, blue: 64 },
|
||||||
callback: "ungroupButton"
|
callback: {
|
||||||
|
method: "ungroupButton"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
colorOptions: [
|
colorOptions: [
|
||||||
|
@ -165,10 +169,14 @@ ToolMenu = function (side, leftInputs, rightInputs, doCallback) {
|
||||||
localPosition: { x: -0.035, y: 0.02, z: -0.005 },
|
localPosition: { x: -0.035, y: 0.02, z: -0.005 },
|
||||||
color: { red: 255, green: 0, blue: 0 }
|
color: { red: 255, green: 0, blue: 0 }
|
||||||
},
|
},
|
||||||
command: "setCurrentColor",
|
command: {
|
||||||
commandParameter: "colorSwatch1.color",
|
method: "setCurrentColor",
|
||||||
callback: "setColor",
|
parameter: "colorSwatch1.color"
|
||||||
callbackParameter: "colorSwatch1.color"
|
},
|
||||||
|
callback: {
|
||||||
|
method: "setColor",
|
||||||
|
parameter: "colorSwatch1.color"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "colorSwatch2",
|
id: "colorSwatch2",
|
||||||
|
@ -178,10 +186,14 @@ ToolMenu = function (side, leftInputs, rightInputs, doCallback) {
|
||||||
localPosition: { x: -0.01, y: 0.02, z: -0.005 },
|
localPosition: { x: -0.01, y: 0.02, z: -0.005 },
|
||||||
color: { red: 0, green: 255, blue: 0 }
|
color: { red: 0, green: 255, blue: 0 }
|
||||||
},
|
},
|
||||||
command: "setCurrentColor",
|
command: {
|
||||||
commandParameter: "colorSwatch2.color",
|
method: "setCurrentColor",
|
||||||
callback: "setColor",
|
parameter: "colorSwatch2.color"
|
||||||
callbackParameter: "colorSwatch2.color"
|
},
|
||||||
|
callback: {
|
||||||
|
method: "setColor",
|
||||||
|
parameter: "colorSwatch2.color"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "colorSwatch3",
|
id: "colorSwatch3",
|
||||||
|
@ -191,10 +203,14 @@ ToolMenu = function (side, leftInputs, rightInputs, doCallback) {
|
||||||
localPosition: { x: -0.035, y: 0.045, z: -0.005 },
|
localPosition: { x: -0.035, y: 0.045, z: -0.005 },
|
||||||
color: { red: 0, green: 0, blue: 255 }
|
color: { red: 0, green: 0, blue: 255 }
|
||||||
},
|
},
|
||||||
command: "setCurrentColor",
|
command: {
|
||||||
commandParameter: "colorSwatch3.color",
|
method: "setCurrentColor",
|
||||||
callback: "setColor",
|
parameter: "colorSwatch3.color"
|
||||||
callbackParameter: "colorSwatch3.color"
|
},
|
||||||
|
callback: {
|
||||||
|
method: "setColor",
|
||||||
|
parameter: "colorSwatch3.color"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "colorSwatch4",
|
id: "colorSwatch4",
|
||||||
|
@ -204,10 +220,14 @@ ToolMenu = function (side, leftInputs, rightInputs, doCallback) {
|
||||||
localPosition: { x: -0.01, y: 0.045, z: -0.005 },
|
localPosition: { x: -0.01, y: 0.045, z: -0.005 },
|
||||||
color: { red: 255, green: 255, blue: 255 }
|
color: { red: 255, green: 255, blue: 255 }
|
||||||
},
|
},
|
||||||
command: "setCurrentColor",
|
command: {
|
||||||
commandParameter: "colorSwatch4.color",
|
method: "setCurrentColor",
|
||||||
callback: "setColor",
|
parameter: "colorSwatch4.color"
|
||||||
callbackParameter: "colorSwatch4.color"
|
},
|
||||||
|
callback: {
|
||||||
|
method: "setColor",
|
||||||
|
parameter: "colorSwatch4.color"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "currentColor",
|
id: "currentColor",
|
||||||
|
@ -243,7 +263,9 @@ ToolMenu = function (side, leftInputs, rightInputs, doCallback) {
|
||||||
color: { red: 0, green: 240, blue: 240 }
|
color: { red: 0, green: 240, blue: 240 }
|
||||||
},
|
},
|
||||||
label: " SCALE",
|
label: " SCALE",
|
||||||
callback: "scaleTool"
|
callback: {
|
||||||
|
method: "scaleTool"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "cloneButton",
|
id: "cloneButton",
|
||||||
|
@ -253,7 +275,9 @@ ToolMenu = function (side, leftInputs, rightInputs, doCallback) {
|
||||||
color: { red: 240, green: 240, blue: 0 }
|
color: { red: 240, green: 240, blue: 0 }
|
||||||
},
|
},
|
||||||
label: " CLONE",
|
label: " CLONE",
|
||||||
callback: "cloneTool"
|
callback: {
|
||||||
|
method: "cloneTool"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "groupButton",
|
id: "groupButton",
|
||||||
|
@ -264,7 +288,9 @@ ToolMenu = function (side, leftInputs, rightInputs, doCallback) {
|
||||||
},
|
},
|
||||||
label: " GROUP",
|
label: " GROUP",
|
||||||
toolOptions: "groupOptions",
|
toolOptions: "groupOptions",
|
||||||
callback: "groupTool"
|
callback: {
|
||||||
|
method: "groupTool"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "colorButton",
|
id: "colorButton",
|
||||||
|
@ -275,8 +301,10 @@ ToolMenu = function (side, leftInputs, rightInputs, doCallback) {
|
||||||
},
|
},
|
||||||
label: " COLOR",
|
label: " COLOR",
|
||||||
toolOptions: "colorOptions",
|
toolOptions: "colorOptions",
|
||||||
callback: "colorTool",
|
callback: {
|
||||||
callbackParameter: "currentColor.color"
|
method: "colorTool",
|
||||||
|
parameter: "currentColor.color"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "deleteButton",
|
id: "deleteButton",
|
||||||
|
@ -286,7 +314,9 @@ ToolMenu = function (side, leftInputs, rightInputs, doCallback) {
|
||||||
color: { red: 240, green: 60, blue: 60 }
|
color: { red: 240, green: 60, blue: 60 }
|
||||||
},
|
},
|
||||||
label: " DELETE",
|
label: " DELETE",
|
||||||
callback: "deleteTool"
|
callback: {
|
||||||
|
method: "deleteTool"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -379,7 +409,7 @@ ToolMenu = function (side, leftInputs, rightInputs, doCallback) {
|
||||||
}
|
}
|
||||||
properties[optionsItems[i].setting.property] = value;
|
properties[optionsItems[i].setting.property] = value;
|
||||||
if (optionsItems[i].setting.callback) {
|
if (optionsItems[i].setting.callback) {
|
||||||
doCallback(optionsItems[i].setting.callback, value);
|
doCallback(optionsItems[i].setting.callback.method, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
optionsOverlays.push(Overlays.addOverlay(UI_ELEMENTS[optionsItems[i].type].overlay, properties));
|
optionsOverlays.push(Overlays.addOverlay(UI_ELEMENTS[optionsItems[i].type].overlay, properties));
|
||||||
|
@ -521,16 +551,16 @@ ToolMenu = function (side, leftInputs, rightInputs, doCallback) {
|
||||||
openOptions(intersectionItems[intersectedItem].toolOptions);
|
openOptions(intersectionItems[intersectedItem].toolOptions);
|
||||||
}
|
}
|
||||||
if (intersectionItems[intersectedItem].command) {
|
if (intersectionItems[intersectedItem].command) {
|
||||||
if (intersectionItems[intersectedItem].callbackParameter) {
|
if (intersectionItems[intersectedItem].command.parameter) {
|
||||||
parameterValue = evaluateParameter(intersectionItems[intersectedItem].commandParameter);
|
parameterValue = evaluateParameter(intersectionItems[intersectedItem].command.parameter);
|
||||||
}
|
}
|
||||||
doCommand(intersectionItems[intersectedItem].command, parameterValue);
|
doCommand(intersectionItems[intersectedItem].command.method, parameterValue);
|
||||||
}
|
}
|
||||||
if (intersectionItems[intersectedItem].callback) {
|
if (intersectionItems[intersectedItem].callback) {
|
||||||
if (intersectionItems[intersectedItem].callbackParameter) {
|
if (intersectionItems[intersectedItem].callback.parameter) {
|
||||||
parameterValue = evaluateParameter(intersectionItems[intersectedItem].callbackParameter);
|
parameterValue = evaluateParameter(intersectionItems[intersectedItem].callback.parameter);
|
||||||
}
|
}
|
||||||
doCallback(intersectionItems[intersectedItem].callback, parameterValue);
|
doCallback(intersectionItems[intersectedItem].callback.method, parameterValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue