mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-07 21:40:20 +02:00
Apply color to entities when click them
This commit is contained in:
parent
75b481adab
commit
ceba5769e0
2 changed files with 14 additions and 4 deletions
|
@ -327,6 +327,15 @@ Selection = function (side) {
|
|||
rootEntityID = selection[0].id;
|
||||
}
|
||||
|
||||
function applyColor(color) {
|
||||
// Entities without a color property simply ignore the edit.
|
||||
for (i = 0, length = selection.length; i < length; i += 1) {
|
||||
Entities.editEntity(selection[i].id, {
|
||||
color: color
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function clear() {
|
||||
selection = [];
|
||||
selectedEntityID = null;
|
||||
|
@ -361,6 +370,7 @@ Selection = function (side) {
|
|||
finishHandleScaling: finishHandleScaling,
|
||||
finishEditing: finishEditing,
|
||||
cloneEntities: cloneEntities,
|
||||
applyColor: applyColor,
|
||||
deleteEntities: deleteEntities,
|
||||
clear: clear,
|
||||
destroy: destroy
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
TOOL_COLOR = 4,
|
||||
TOOL_DELETE = 5,
|
||||
toolSelected = TOOL_NONE,
|
||||
colorToolColor = { red: 128, green: 128, blue: 128 },
|
||||
|
||||
// Primary objects
|
||||
Inputs,
|
||||
|
@ -854,8 +855,7 @@
|
|||
} else if (toolSelected === TOOL_GROUP) {
|
||||
setState(EDITOR_GROUPING);
|
||||
} else if (toolSelected === TOOL_COLOR) {
|
||||
// TODO
|
||||
print("$$$$$$$ apply color");
|
||||
selection.applyColor(colorToolColor);
|
||||
} else if (toolSelected === TOOL_DELETE) {
|
||||
setState(EDITOR_HIGHLIGHTING);
|
||||
selection.deleteEntities();
|
||||
|
@ -912,8 +912,7 @@
|
|||
} else if (toolSelected === TOOL_GROUP) {
|
||||
setState(EDITOR_GROUPING);
|
||||
} else if (toolSelected === TOOL_COLOR) {
|
||||
// TODO
|
||||
print("$$$$$$$ apply color");
|
||||
selection.applyColor(colorToolColor);
|
||||
} else if (toolSelected === TOOL_DELETE) {
|
||||
selection.deleteEntities();
|
||||
setState(EDITOR_SEARCHING);
|
||||
|
@ -1278,6 +1277,7 @@
|
|||
break;
|
||||
case "setColor":
|
||||
ui.setToolColor(parameter);
|
||||
colorToolColor = parameter;
|
||||
break;
|
||||
default:
|
||||
debug("ERROR: Unexpected command in onUICommand()!");
|
||||
|
|
Loading…
Reference in a new issue