mirror of
https://github.com/overte-org/overte.git
synced 2025-07-22 21:28:54 +02:00
Fixes to Master recording for ACs
This commit is contained in:
parent
429a4d51d5
commit
eb0d91fc7e
2 changed files with 51 additions and 60 deletions
|
@ -33,15 +33,6 @@ var SHOW = 4;
|
||||||
var HIDE = 5;
|
var HIDE = 5;
|
||||||
var LOAD = 6;
|
var LOAD = 6;
|
||||||
|
|
||||||
var COLORS = [];
|
|
||||||
COLORS[PLAY] = { red: PLAY, green: 0, blue: 0 };
|
|
||||||
COLORS[PLAY_LOOP] = { red: PLAY_LOOP, green: 0, blue: 0 };
|
|
||||||
COLORS[STOP] = { red: STOP, green: 0, blue: 0 };
|
|
||||||
COLORS[SHOW] = { red: SHOW, green: 0, blue: 0 };
|
|
||||||
COLORS[HIDE] = { red: HIDE, green: 0, blue: 0 };
|
|
||||||
COLORS[LOAD] = { red: LOAD, green: 0, blue: 0 };
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var windowDimensions = Controller.getViewportDimensions();
|
var windowDimensions = Controller.getViewportDimensions();
|
||||||
var TOOL_ICON_URL = HIFI_PUBLIC_BUCKET + "images/tools/";
|
var TOOL_ICON_URL = HIFI_PUBLIC_BUCKET + "images/tools/";
|
||||||
|
@ -138,6 +129,7 @@ function setupToolBars() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendCommand(id, action) {
|
function sendCommand(id, action) {
|
||||||
|
|
||||||
if (action === SHOW) {
|
if (action === SHOW) {
|
||||||
toolBars[id].selectTool(onOffIcon[id], false);
|
toolBars[id].selectTool(onOffIcon[id], false);
|
||||||
toolBars[id].setAlpha(ALPHA_ON, playIcon[id]);
|
toolBars[id].setAlpha(ALPHA_ON, playIcon[id]);
|
||||||
|
@ -154,24 +146,29 @@ function sendCommand(id, action) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id === (toolBars.length - 1)) {
|
if (id === (toolBars.length - 1))
|
||||||
for (i = 0; i < NUM_AC; i++) {
|
id = -1;
|
||||||
sendCommand(i, action);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var position = { x: controlEntityPosition.x + id * controlEntitySize,
|
var controlEntity = Entities.addEntity({
|
||||||
y: controlEntityPosition.y, z: controlEntityPosition.z };
|
name: 'New Actor Controller',
|
||||||
Entities.addEntity({
|
|
||||||
name: "Actor Controller",
|
|
||||||
userData: clip_url,
|
|
||||||
type: "Box",
|
type: "Box",
|
||||||
position: position,
|
color: { red: 0, green: 0, blue: 0 },
|
||||||
dimensions: { x: controlEntitySize, y: controlEntitySize, z: controlEntitySize },
|
position: controlEntityPosition,
|
||||||
color: COLORS[action],
|
dimensions: { x: controlEntitySize, y: controlEntitySize, z: controlEntitySize },
|
||||||
lifetime: 5
|
visible: false,
|
||||||
});
|
lifetime: 10,
|
||||||
|
userData: JSON.stringify({
|
||||||
|
idKey: {
|
||||||
|
uD_id: id
|
||||||
|
},
|
||||||
|
actionKey: {
|
||||||
|
uD_action: action
|
||||||
|
},
|
||||||
|
clipKey: {
|
||||||
|
uD_url: clip_url
|
||||||
|
}
|
||||||
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function mousePressEvent(event) {
|
function mousePressEvent(event) {
|
||||||
|
@ -191,8 +188,12 @@ function mousePressEvent(event) {
|
||||||
sendCommand(i, PLAY_LOOP);
|
sendCommand(i, PLAY_LOOP);
|
||||||
} else if (stopIcon[i] === toolBars[i].clicked(clickedOverlay, false)) {
|
} else if (stopIcon[i] === toolBars[i].clicked(clickedOverlay, false)) {
|
||||||
sendCommand(i, STOP);
|
sendCommand(i, STOP);
|
||||||
} else if (loadIcon[i] === toolBars[i].clicked(clickedOverlay, false)) {
|
} else if (loadIcon[i] === toolBars[i].clicked(clickedOverlay, false)) {
|
||||||
sendCommand(i, LOAD);
|
input_text = Window.prompt("Insert the url of the clip: ","");
|
||||||
|
if(!(input_text === "" || input_text === null)) {
|
||||||
|
clip_url = input_text;
|
||||||
|
sendCommand(i, LOAD);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Check individual controls
|
// Check individual controls
|
||||||
for (i = 0; i < NUM_AC; i++) {
|
for (i = 0; i < NUM_AC; i++) {
|
||||||
|
@ -210,7 +211,7 @@ function mousePressEvent(event) {
|
||||||
sendCommand(i, STOP);
|
sendCommand(i, STOP);
|
||||||
} else if (loadIcon[i] === toolBars[i].clicked(clickedOverlay, false)) {
|
} else if (loadIcon[i] === toolBars[i].clicked(clickedOverlay, false)) {
|
||||||
input_text = Window.prompt("Insert the url of the clip: ","");
|
input_text = Window.prompt("Insert the url of the clip: ","");
|
||||||
if(!(input_text === "" || input_text === null)){
|
if(!(input_text === "" || input_text === null)) {
|
||||||
clip_url = input_text;
|
clip_url = input_text;
|
||||||
sendCommand(i, LOAD);
|
sendCommand(i, LOAD);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,18 +38,6 @@ var SHOW = 4;
|
||||||
var HIDE = 5;
|
var HIDE = 5;
|
||||||
var LOAD = 6;
|
var LOAD = 6;
|
||||||
|
|
||||||
var COLORS = [];
|
|
||||||
COLORS[PLAY] = { red: PLAY, green: 0, blue: 0 };
|
|
||||||
COLORS[PLAY_LOOP] = { red: PLAY_LOOP, green: 0, blue: 0 };
|
|
||||||
COLORS[STOP] = { red: STOP, green: 0, blue: 0 };
|
|
||||||
COLORS[SHOW] = { red: SHOW, green: 0, blue: 0 };
|
|
||||||
COLORS[HIDE] = { red: HIDE, green: 0, blue: 0 };
|
|
||||||
COLORS[LOAD] = { red: LOAD, green: 0, blue: 0 };
|
|
||||||
|
|
||||||
controlEntityPosition.x += id * controlEntitySize;
|
|
||||||
|
|
||||||
Avatar.loadRecording(clip_url);
|
|
||||||
|
|
||||||
Avatar.setPlayFromCurrentLocation(playFromCurrentLocation);
|
Avatar.setPlayFromCurrentLocation(playFromCurrentLocation);
|
||||||
Avatar.setPlayerUseDisplayName(useDisplayName);
|
Avatar.setPlayerUseDisplayName(useDisplayName);
|
||||||
Avatar.setPlayerUseAttachments(useAttachments);
|
Avatar.setPlayerUseAttachments(useAttachments);
|
||||||
|
@ -67,27 +55,29 @@ function setupEntityViewer() {
|
||||||
EntityViewer.queryOctree();
|
EntityViewer.queryOctree();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAction(controlEntity) {
|
function getAction(controlEntity) {
|
||||||
clip_url = controlEntity.userData;
|
if (controlEntity === null) {
|
||||||
|
return DO_NOTHING;
|
||||||
|
}
|
||||||
|
|
||||||
|
var userData = JSON.parse(Entities.getEntityProperties(controlEntity, ["userData"]).userData);
|
||||||
|
|
||||||
if (controlEntity === null ||
|
var uD_id = userData.idKey.uD_id;
|
||||||
controlEntity.position.x !== controlEntityPosition.x ||
|
var uD_action = userData.actionKey.uD_action;
|
||||||
controlEntity.position.y !== controlEntityPosition.y ||
|
var uD_url = userData.clipKey.uD_url;
|
||||||
controlEntity.position.z !== controlEntityPosition.z ||
|
|
||||||
controlEntity.dimensions.x !== controlEntitySize) {
|
print("Sono " + id + " e ho ricevuto un comando da " + uD_id);
|
||||||
|
|
||||||
|
Entities.deleteEntity((Entities.getEntityProperties(controlEntity)).id);
|
||||||
|
|
||||||
|
if(uD_id === id || uD_id === -1) {
|
||||||
|
if(uD_action === 6)
|
||||||
|
clip_url = uD_url;
|
||||||
|
|
||||||
|
return uD_action;
|
||||||
|
} else {
|
||||||
return DO_NOTHING;
|
return DO_NOTHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i in COLORS) {
|
|
||||||
if (controlEntity.color.red === COLORS[i].red &&
|
|
||||||
controlEntity.color.green === COLORS[i].green &&
|
|
||||||
controlEntity.color.blue === COLORS[i].blue) {
|
|
||||||
Entities.deleteEntity(controlEntity.id);
|
|
||||||
return parseInt(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return DO_NOTHING;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
count = 100; // This is necessary to wait for the audio mixer to connect
|
count = 100; // This is necessary to wait for the audio mixer to connect
|
||||||
|
@ -100,7 +90,7 @@ function update(event) {
|
||||||
|
|
||||||
|
|
||||||
var controlEntity = Entities.findClosestEntity(controlEntityPosition, controlEntitySize);
|
var controlEntity = Entities.findClosestEntity(controlEntityPosition, controlEntitySize);
|
||||||
var action = getAction(Entities.getEntityProperties(controlEntity));
|
var action = getAction(controlEntity);
|
||||||
|
|
||||||
switch(action) {
|
switch(action) {
|
||||||
case PLAY:
|
case PLAY:
|
||||||
|
|
Loading…
Reference in a new issue