mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 06:53:01 +02:00
Merge pull request #6347 from EdgarPironti/record_branch
Set clip for ControlledAC
This commit is contained in:
commit
e7a6c58a9a
2 changed files with 42 additions and 9 deletions
|
@ -17,17 +17,21 @@ var NAMES = new Array("Craig", "Clement", "Jeff"); // ACs names ordered by IDs (
|
||||||
|
|
||||||
// Those variables MUST be common to every scripts
|
// Those variables MUST be common to every scripts
|
||||||
var controlEntitySize = 0.25;
|
var controlEntitySize = 0.25;
|
||||||
var controlEntityPosition = { x: 2000 , y: 0, z: 0 };
|
var controlEntityPosition = { x: 0, y: 0, z: 0 };
|
||||||
|
|
||||||
// Script. DO NOT MODIFY BEYOND THIS LINE.
|
// Script. DO NOT MODIFY BEYOND THIS LINE.
|
||||||
Script.include("../libraries/toolBars.js");
|
Script.include("../libraries/toolBars.js");
|
||||||
|
|
||||||
|
var clip_url = null;
|
||||||
|
var input_text = null;
|
||||||
|
|
||||||
var DO_NOTHING = 0;
|
var DO_NOTHING = 0;
|
||||||
var PLAY = 1;
|
var PLAY = 1;
|
||||||
var PLAY_LOOP = 2;
|
var PLAY_LOOP = 2;
|
||||||
var STOP = 3;
|
var STOP = 3;
|
||||||
var SHOW = 4;
|
var SHOW = 4;
|
||||||
var HIDE = 5;
|
var HIDE = 5;
|
||||||
|
var LOAD = 6;
|
||||||
|
|
||||||
var COLORS = [];
|
var COLORS = [];
|
||||||
COLORS[PLAY] = { red: PLAY, green: 0, blue: 0 };
|
COLORS[PLAY] = { red: PLAY, green: 0, blue: 0 };
|
||||||
|
@ -35,6 +39,7 @@ COLORS[PLAY_LOOP] = { red: PLAY_LOOP, green: 0, blue: 0 };
|
||||||
COLORS[STOP] = { red: STOP, green: 0, blue: 0 };
|
COLORS[STOP] = { red: STOP, green: 0, blue: 0 };
|
||||||
COLORS[SHOW] = { red: SHOW, green: 0, blue: 0 };
|
COLORS[SHOW] = { red: SHOW, green: 0, blue: 0 };
|
||||||
COLORS[HIDE] = { red: HIDE, green: 0, blue: 0 };
|
COLORS[HIDE] = { red: HIDE, green: 0, blue: 0 };
|
||||||
|
COLORS[LOAD] = { red: LOAD, green: 0, blue: 0 };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -53,6 +58,7 @@ var onOffIcon = new Array();
|
||||||
var playIcon = new Array();
|
var playIcon = new Array();
|
||||||
var playLoopIcon = new Array();
|
var playLoopIcon = new Array();
|
||||||
var stopIcon = new Array();
|
var stopIcon = new Array();
|
||||||
|
var loadIcon = new Array();
|
||||||
setupToolBars();
|
setupToolBars();
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,6 +110,14 @@ function setupToolBars() {
|
||||||
alpha: ALPHA_OFF,
|
alpha: ALPHA_OFF,
|
||||||
visible: true
|
visible: true
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
|
loadIcon[i] = toolBars[i].addTool({
|
||||||
|
imageURL: TOOL_ICON_URL + "recording-upload.svg",
|
||||||
|
width: Tool.IMAGE_WIDTH,
|
||||||
|
height: Tool.IMAGE_HEIGHT,
|
||||||
|
alpha: ALPHA_OFF,
|
||||||
|
visible: true
|
||||||
|
}, false);
|
||||||
|
|
||||||
nameOverlays.push(Overlays.addOverlay("text", {
|
nameOverlays.push(Overlays.addOverlay("text", {
|
||||||
backgroundColor: { red: 0, green: 0, blue: 0 },
|
backgroundColor: { red: 0, green: 0, blue: 0 },
|
||||||
|
@ -129,11 +143,13 @@ function sendCommand(id, action) {
|
||||||
toolBars[id].setAlpha(ALPHA_ON, playIcon[id]);
|
toolBars[id].setAlpha(ALPHA_ON, playIcon[id]);
|
||||||
toolBars[id].setAlpha(ALPHA_ON, playLoopIcon[id]);
|
toolBars[id].setAlpha(ALPHA_ON, playLoopIcon[id]);
|
||||||
toolBars[id].setAlpha(ALPHA_ON, stopIcon[id]);
|
toolBars[id].setAlpha(ALPHA_ON, stopIcon[id]);
|
||||||
|
toolBars[id].setAlpha(ALPHA_ON, loadIcon[id]);
|
||||||
} else if (action === HIDE) {
|
} else if (action === HIDE) {
|
||||||
toolBars[id].selectTool(onOffIcon[id], true);
|
toolBars[id].selectTool(onOffIcon[id], true);
|
||||||
toolBars[id].setAlpha(ALPHA_OFF, playIcon[id]);
|
toolBars[id].setAlpha(ALPHA_OFF, playIcon[id]);
|
||||||
toolBars[id].setAlpha(ALPHA_OFF, playLoopIcon[id]);
|
toolBars[id].setAlpha(ALPHA_OFF, playLoopIcon[id]);
|
||||||
toolBars[id].setAlpha(ALPHA_OFF, stopIcon[id]);
|
toolBars[id].setAlpha(ALPHA_OFF, stopIcon[id]);
|
||||||
|
toolBars[id].setAlpha(ALPHA_OFF, loadIcon[id]);
|
||||||
} else if (toolBars[id].toolSelected(onOffIcon[id])) {
|
} else if (toolBars[id].toolSelected(onOffIcon[id])) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -148,6 +164,8 @@ function sendCommand(id, action) {
|
||||||
var position = { x: controlEntityPosition.x + id * controlEntitySize,
|
var position = { x: controlEntityPosition.x + id * controlEntitySize,
|
||||||
y: controlEntityPosition.y, z: controlEntityPosition.z };
|
y: controlEntityPosition.y, z: controlEntityPosition.z };
|
||||||
Entities.addEntity({
|
Entities.addEntity({
|
||||||
|
name: "Actor Controller",
|
||||||
|
userData: clip_url,
|
||||||
type: "Box",
|
type: "Box",
|
||||||
position: position,
|
position: position,
|
||||||
dimensions: { x: controlEntitySize, y: controlEntitySize, z: controlEntitySize },
|
dimensions: { x: controlEntitySize, y: controlEntitySize, z: controlEntitySize },
|
||||||
|
@ -173,6 +191,8 @@ 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)) {
|
||||||
|
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++) {
|
||||||
|
@ -188,6 +208,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)) {
|
||||||
|
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 {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -231,4 +257,4 @@ Controller.mousePressEvent.connect(mousePressEvent);
|
||||||
Script.update.connect(update);
|
Script.update.connect(update);
|
||||||
Script.scriptEnding.connect(scriptEnding);
|
Script.scriptEnding.connect(scriptEnding);
|
||||||
|
|
||||||
moveUI();
|
moveUI();
|
|
@ -9,10 +9,9 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
|
|
||||||
|
|
||||||
// Set the following variables to the values needed
|
// Set the following variables to the values needed
|
||||||
var filename = "/Users/clement/Desktop/recording.hfr";
|
var clip_url = null;
|
||||||
var playFromCurrentLocation = true;
|
var playFromCurrentLocation = true;
|
||||||
var useDisplayName = true;
|
var useDisplayName = true;
|
||||||
var useAttachments = true;
|
var useAttachments = true;
|
||||||
|
@ -21,8 +20,6 @@ var useAvatarModel = true;
|
||||||
// ID of the agent. Two agents can't have the same ID.
|
// ID of the agent. Two agents can't have the same ID.
|
||||||
var id = 0;
|
var id = 0;
|
||||||
|
|
||||||
// Set avatar model URL
|
|
||||||
Avatar.skeletonModelURL = "https://hifi-public.s3.amazonaws.com/marketplace/contents/e21c0b95-e502-4d15-8c41-ea2fc40f1125/3585ddf674869a67d31d5964f7b52de1.fst?1427169998";
|
|
||||||
// Set position/orientation/scale here if playFromCurrentLocation is true
|
// Set position/orientation/scale here if playFromCurrentLocation is true
|
||||||
Avatar.position = { x:1, y: 1, z: 1 };
|
Avatar.position = { x:1, y: 1, z: 1 };
|
||||||
Avatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
Avatar.orientation = Quat.fromPitchYawRollDegrees(0, 0, 0);
|
||||||
|
@ -30,7 +27,7 @@ Avatar.scale = 1.0;
|
||||||
|
|
||||||
// Those variables MUST be common to every scripts
|
// Those variables MUST be common to every scripts
|
||||||
var controlEntitySize = 0.25;
|
var controlEntitySize = 0.25;
|
||||||
var controlEntityPosition = { x: 2000, y: 0, z: 0 };
|
var controlEntityPosition = { x: 0, y: 0, z: 0 };
|
||||||
|
|
||||||
// Script. DO NOT MODIFY BEYOND THIS LINE.
|
// Script. DO NOT MODIFY BEYOND THIS LINE.
|
||||||
var DO_NOTHING = 0;
|
var DO_NOTHING = 0;
|
||||||
|
@ -39,6 +36,7 @@ var PLAY_LOOP = 2;
|
||||||
var STOP = 3;
|
var STOP = 3;
|
||||||
var SHOW = 4;
|
var SHOW = 4;
|
||||||
var HIDE = 5;
|
var HIDE = 5;
|
||||||
|
var LOAD = 6;
|
||||||
|
|
||||||
var COLORS = [];
|
var COLORS = [];
|
||||||
COLORS[PLAY] = { red: PLAY, green: 0, blue: 0 };
|
COLORS[PLAY] = { red: PLAY, green: 0, blue: 0 };
|
||||||
|
@ -46,10 +44,11 @@ COLORS[PLAY_LOOP] = { red: PLAY_LOOP, green: 0, blue: 0 };
|
||||||
COLORS[STOP] = { red: STOP, green: 0, blue: 0 };
|
COLORS[STOP] = { red: STOP, green: 0, blue: 0 };
|
||||||
COLORS[SHOW] = { red: SHOW, green: 0, blue: 0 };
|
COLORS[SHOW] = { red: SHOW, green: 0, blue: 0 };
|
||||||
COLORS[HIDE] = { red: HIDE, green: 0, blue: 0 };
|
COLORS[HIDE] = { red: HIDE, green: 0, blue: 0 };
|
||||||
|
COLORS[LOAD] = { red: LOAD, green: 0, blue: 0 };
|
||||||
|
|
||||||
controlEntityPosition.x += id * controlEntitySize;
|
controlEntityPosition.x += id * controlEntitySize;
|
||||||
|
|
||||||
Avatar.loadRecording(filename);
|
Avatar.loadRecording(clip_url);
|
||||||
|
|
||||||
Avatar.setPlayFromCurrentLocation(playFromCurrentLocation);
|
Avatar.setPlayFromCurrentLocation(playFromCurrentLocation);
|
||||||
Avatar.setPlayerUseDisplayName(useDisplayName);
|
Avatar.setPlayerUseDisplayName(useDisplayName);
|
||||||
|
@ -68,7 +67,9 @@ function setupEntityViewer() {
|
||||||
EntityViewer.queryOctree();
|
EntityViewer.queryOctree();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAction(controlEntity) {
|
function getAction(controlEntity) {
|
||||||
|
clip_url = controlEntity.userData;
|
||||||
|
|
||||||
if (controlEntity === null ||
|
if (controlEntity === null ||
|
||||||
controlEntity.position.x !== controlEntityPosition.x ||
|
controlEntity.position.x !== controlEntityPosition.x ||
|
||||||
controlEntity.position.y !== controlEntityPosition.y ||
|
controlEntity.position.y !== controlEntityPosition.y ||
|
||||||
|
@ -141,6 +142,12 @@ function update(event) {
|
||||||
}
|
}
|
||||||
Agent.isAvatar = false;
|
Agent.isAvatar = false;
|
||||||
break;
|
break;
|
||||||
|
case LOAD:
|
||||||
|
print("Load");
|
||||||
|
if(clip_url !== null) {
|
||||||
|
Avatar.loadRecording(clip_url);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case DO_NOTHING:
|
case DO_NOTHING:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue