Merge pull request #4099 from huffman/update-entity-properties

Add missing model properties to entity property window
This commit is contained in:
Brad Hefta-Gaub 2015-01-13 17:12:06 -08:00
commit 7e55d79ab7
3 changed files with 40 additions and 26 deletions

View file

@ -662,8 +662,6 @@ function setupModelMenus() {
print("setupModelMenus()"); print("setupModelMenus()");
// adj our menuitems // adj our menuitems
Menu.addMenuItem({ menuName: "Edit", menuItemName: "Models", isSeparator: true, beforeItem: "Physics" }); Menu.addMenuItem({ menuName: "Edit", menuItemName: "Models", isSeparator: true, beforeItem: "Physics" });
Menu.addMenuItem({ menuName: "Edit", menuItemName: "Edit Properties...",
shortcutKeyEvent: { text: "`" }, afterItem: "Models" });
if (!Menu.menuItemExists("Edit", "Delete")) { if (!Menu.menuItemExists("Edit", "Delete")) {
print("no delete... adding ours"); print("no delete... adding ours");
Menu.addMenuItem({ menuName: "Edit", menuItemName: "Delete", Menu.addMenuItem({ menuName: "Edit", menuItemName: "Delete",
@ -674,7 +672,7 @@ function setupModelMenus() {
} }
Menu.addMenuItem({ menuName: "Edit", menuItemName: "Model List...", afterItem: "Models" }); Menu.addMenuItem({ menuName: "Edit", menuItemName: "Model List...", afterItem: "Models" });
Menu.addMenuItem({ menuName: "Edit", menuItemName: "Paste Models", shortcutKey: "CTRL+META+V", afterItem: "Edit Properties..." }); Menu.addMenuItem({ menuName: "Edit", menuItemName: "Paste Models", shortcutKey: "CTRL+META+V", afterItem: "Model List..." });
Menu.addMenuItem({ menuName: "Edit", menuItemName: "Allow Selecting of Large Models", shortcutKey: "CTRL+META+L", Menu.addMenuItem({ menuName: "Edit", menuItemName: "Allow Selecting of Large Models", shortcutKey: "CTRL+META+L",
afterItem: "Paste Models", isCheckable: true, isChecked: true }); afterItem: "Paste Models", isCheckable: true, isChecked: true });
Menu.addMenuItem({ menuName: "Edit", menuItemName: "Allow Selecting of Small Models", shortcutKey: "CTRL+META+S", Menu.addMenuItem({ menuName: "Edit", menuItemName: "Allow Selecting of Small Models", shortcutKey: "CTRL+META+S",
@ -696,7 +694,6 @@ setupModelMenus(); // do this when first running our script.
function cleanupModelMenus() { function cleanupModelMenus() {
Menu.removeSeparator("Edit", "Models"); Menu.removeSeparator("Edit", "Models");
Menu.removeMenuItem("Edit", "Edit Properties...");
if (modelMenuAddedDelete) { if (modelMenuAddedDelete) {
// delete our menuitems // delete our menuitems
Menu.removeMenuItem("Edit", "Delete"); Menu.removeMenuItem("Edit", "Delete");
@ -798,22 +795,6 @@ function handeMenuEvent(menuItem) {
MyAvatar.position = selectedModel.properties.position; MyAvatar.position = selectedModel.properties.position;
} }
} }
} else if (menuItem == "Edit Properties...") {
// good place to put the properties dialog
editModelID = -1;
if (selectionManager.selections.length == 1) {
print(" Edit Properties.... selectedEntityID="+ selectedEntityID);
editModelID = selectionManager.selections[0];
} else {
print(" Edit Properties.... not holding...");
}
if (editModelID != -1) {
print(" Edit Properties.... about to edit properties...");
entityPropertyDialogBox.openDialog(editModelID);
selectionManager._update();
}
} else if (menuItem == "Paste Models") { } else if (menuItem == "Paste Models") {
modelImporter.paste(); modelImporter.paste();
} else if (menuItem == "Export Models") { } else if (menuItem == "Export Models") {
@ -841,9 +822,6 @@ Controller.keyPressEvent.connect(function(event) {
Controller.keyReleaseEvent.connect(function (event) { Controller.keyReleaseEvent.connect(function (event) {
// since sometimes our menu shortcut keys don't work, trap our menu items here also and fire the appropriate menu items // since sometimes our menu shortcut keys don't work, trap our menu items here also and fire the appropriate menu items
if (event.text == "`") {
handeMenuEvent("Edit Properties...");
}
if (event.text == "BACKSPACE" || event.text == "DELETE") { if (event.text == "BACKSPACE" || event.text == "DELETE") {
handeMenuEvent("Delete"); handeMenuEvent("Delete");
} else if (event.text == "TAB") { } else if (event.text == "TAB") {

View file

@ -31,8 +31,13 @@
} }
function createEmitTextPropertyUpdateFunction(propertyName) { function createEmitTextPropertyUpdateFunction(propertyName) {
return function() { return function() {
var properties = {};
properties[propertyName] = this.value;
EventBridge.emitWebEvent( EventBridge.emitWebEvent(
'{ "type":"update", "properties":{"' + propertyName + '":"' + this.value + '"}}' JSON.stringify({
type: "update",
properties: properties,
})
); );
}; };
} }
@ -146,6 +151,9 @@
var elModelAnimationPlaying = document.getElementById("property-model-animation-playing"); var elModelAnimationPlaying = document.getElementById("property-model-animation-playing");
var elModelAnimationFPS = document.getElementById("property-model-animation-fps"); var elModelAnimationFPS = document.getElementById("property-model-animation-fps");
var elModelAnimationFrame = document.getElementById("property-model-animation-frame"); var elModelAnimationFrame = document.getElementById("property-model-animation-frame");
var elModelAnimationSettings = document.getElementById("property-model-animation-settings");
var elModelTextures = document.getElementById("property-model-textures");
var elModelOriginalTextures = document.getElementById("property-model-original-textures");
var elTextSections = document.querySelectorAll(".text-section"); var elTextSections = document.querySelectorAll(".text-section");
var elTextText = document.getElementById("property-text-text"); var elTextText = document.getElementById("property-text-text");
@ -244,6 +252,10 @@
elModelAnimationURL.value = properties.animationURL; elModelAnimationURL.value = properties.animationURL;
elModelAnimationPlaying.checked = properties.animationIsPlaying; elModelAnimationPlaying.checked = properties.animationIsPlaying;
elModelAnimationFPS.value = properties.animationFPS; elModelAnimationFPS.value = properties.animationFPS;
elModelAnimationFrame.value = properties.animationFrameIndex;
elModelAnimationSettings.value = properties.animationSettings;
elModelTextures.value = properties.textures;
elModelOriginalTextures.value = properties.originalTextures;
} }
if (properties.type != "Text") { if (properties.type != "Text") {
@ -387,6 +399,8 @@
elModelAnimationPlaying.addEventListener('change', createEmitCheckedPropertyUpdateFunction('animationIsPlaying')); elModelAnimationPlaying.addEventListener('change', createEmitCheckedPropertyUpdateFunction('animationIsPlaying'));
elModelAnimationFPS.addEventListener('change', createEmitNumberPropertyUpdateFunction('animationFPS')); elModelAnimationFPS.addEventListener('change', createEmitNumberPropertyUpdateFunction('animationFPS'));
elModelAnimationFrame.addEventListener('change', createEmitNumberPropertyUpdateFunction('animationFrameIndex')); elModelAnimationFrame.addEventListener('change', createEmitNumberPropertyUpdateFunction('animationFrameIndex'));
elModelAnimationSettings.addEventListener('change', createEmitTextPropertyUpdateFunction('animationSettings'));
elModelTextures.addEventListener('change', createEmitTextPropertyUpdateFunction('textures'));
elTextText.addEventListener('change', createEmitTextPropertyUpdateFunction('text')); elTextText.addEventListener('change', createEmitTextPropertyUpdateFunction('text'));
elTextLineHeight.addEventListener('change', createEmitNumberPropertyUpdateFunction('lineHeight')); elTextLineHeight.addEventListener('change', createEmitNumberPropertyUpdateFunction('lineHeight'));
@ -429,7 +443,6 @@
})); }));
}); });
var resizing = false; var resizing = false;
var startX = 0; var startX = 0;
var originalWidth = 0; var originalWidth = 0;
@ -679,6 +692,24 @@
<input class="coord" type='number' id="property-model-animation-frame"></input> <input class="coord" type='number' id="property-model-animation-frame"></input>
</td> </td>
</tr> </tr>
<tr class="model-section">
<td class="label">Animation Settings</td>
<td>
<textarea id="property-model-animation-settings" value='asdfasdf'></textarea>
</td>
</tr>
<tr class="model-section">
<td class="label">Textures</td>
<td>
<textarea id="property-model-textures" value='asdfasdf'></textarea>
</td>
</tr>
<tr class="model-section">
<td class="label">Original Textures</td>
<td>
<textarea id="property-model-original-textures" readonly value='asdfasdf'></textarea>
</td>
</tr>
<tr class="text-section"> <tr class="text-section">

View file

@ -90,12 +90,17 @@ input[type=button] {
font-size: .9em; font-size: .9em;
} }
input { textarea, input {
padding: 2px; padding: 2px;
border: 1px solid #999; border: 1px solid #999;
background-color: #eee; background-color: #eee;
} }
textarea {
width: 100%;
resize: vertical;
}
input.url { input.url {
width: 100%; width: 100%;
} }