Fixes: Prompt and userData

This commit is contained in:
EdgarPironti 2015-11-09 18:14:42 -08:00
parent 0f057d7229
commit 55d386aaab
2 changed files with 12 additions and 11 deletions

View file

@ -22,8 +22,8 @@ var controlEntityPosition = { x: 0, y: 0, z: 0 };
// Script. DO NOT MODIFY BEYOND THIS LINE.
Script.include("../libraries/toolBars.js");
var filename = null;
var fileloaded = null;
var clip_url = null;
var input_text = null;
var DO_NOTHING = 0;
var PLAY = 1;
@ -164,7 +164,8 @@ function sendCommand(id, action) {
var position = { x: controlEntityPosition.x + id * controlEntitySize,
y: controlEntityPosition.y, z: controlEntityPosition.z };
Entities.addEntity({
name: filename,
name: "Actor Controller",
userData: clip_url,
type: "Box",
position: position,
dimensions: { x: controlEntitySize, y: controlEntitySize, z: controlEntitySize },
@ -208,9 +209,9 @@ function mousePressEvent(event) {
} else if (stopIcon[i] === toolBars[i].clicked(clickedOverlay, false)) {
sendCommand(i, STOP);
} else if (loadIcon[i] === toolBars[i].clicked(clickedOverlay, false)) {
fileloaded = Window.browse("Load recording from file", ".", "Recordings (*.hfr *.rec *.HFR *.REC)");
if (!(fileloaded === "null" || fileloaded === null || fileloaded === "")) {
filename = fileloaded;
input_text = Window.prompt("Insert the url of the clip: ","");
if(!(input_text === "" || input_text === null)){
clip_url = input_text;
sendCommand(i, LOAD);
}
} else {

View file

@ -12,7 +12,7 @@
HIFI_PUBLIC_BUCKET = "http://s3.amazonaws.com/hifi-public/";
// Set the following variables to the values needed
var filename = "/Users/clement/Desktop/recording.hfr";
var clip_url = "https://dl.dropboxusercontent.com/u/14127429/Clips/recording1.hfr";
var playFromCurrentLocation = true;
var useDisplayName = true;
var useAttachments = true;
@ -51,7 +51,7 @@ COLORS[LOAD] = { red: LOAD, green: 0, blue: 0 };
controlEntityPosition.x += id * controlEntitySize;
Avatar.loadRecording(filename);
Avatar.loadRecording(clip_url);
Avatar.setPlayFromCurrentLocation(playFromCurrentLocation);
Avatar.setPlayerUseDisplayName(useDisplayName);
@ -71,7 +71,7 @@ function setupEntityViewer() {
}
function getAction(controlEntity) {
filename = controlEntity.name;
clip_url = controlEntity.userData;
if (controlEntity === null ||
controlEntity.position.x !== controlEntityPosition.x ||
@ -147,8 +147,8 @@ function update(event) {
break;
case LOAD:
print("Load");
if(filename !== null) {
Avatar.loadRecording(filename);
if(clip_url !== null) {
Avatar.loadRecording(clip_url);
}
break;
case DO_NOTHING: